Skip to content

Please allow us to mock the Client used by _withClient #64

Closed
@Hixie

Description

@Hixie

We would like to be able to inject a client into the http package (e.g. the MockClient obtained from http/testing) such that the top-level methods such as "get" and "head" and so forth will use the mock client instead of a brand new Client.

We had previously implemented this by forking http and changing it as follows:
https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/http/client.dart#L32

We would like to just use the http package directly now, but without this way to inject a MockClient, we have the problem that anyone using the convenience methods like http.get() will end up doing actual network traffic in our tests instead of hitting our mock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions