Skip to content

Feature request: Add factory constructor to HttpHeaders interface #36675

Open
@cah4a

Description

I'm working on a server mocking library. Something like nock for Javascript, but for Dart/Flutter.

I have an issue with constructing HttpHeaders because package dart:http doesn't provide any constructor for it.

Thus, I have to either implement all the functionality by myself, either use a weird workaround:

Future<HttpHeaders> createHeaders() async {
    final request = await originalHttpClient.head("localhost", 0, "");
    return request.headers;
}

Both solutions are not so good and have disadvantages.

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-iotype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions