Skip to content

_recorder - matching http headers as well as URL #639

Open

Description

For my project, I need to mock responses from an API where some of the parameters are included in a HTTP header, so for example I would make a request to http://api.com/projects with a http header set to user-id: joebloggs

Currently I am recording the responses by doing:

@_recorder.record(filepath="out.yaml")
def test_something():
    ...

and then I'm loading the yaml file like this:

@responses.activate
def test_something():
    responses.add_from_file("out.yaml")
    ...

Is it possible to set up the registry to match on this HTTP header, and also save this header in the .yaml files that it generates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions