Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headers don't seem to be considered when matching requests to cassette responses #4

Open
robertbell opened this issue Sep 27, 2017 · 2 comments

Comments

@robertbell
Copy link

Hey there.

I've got two tests using the same method, path & query string, but different Auth headers.

My tests are there to ensure when a dodgy auth header is provided that the service I'm integrating with responds with a 401, and that I deal with that appropriately.

When recording the tests work fine but when replaying, all tests using the same method, path and, query string get the same HTTP response. So half the tests fail every time in my case.

Is this by design? I'm using one cassette file per fixture at the moment, using one per test would be an ok workaround but I'd prefer to group them if possible.

Thanks, and keep up the great work!

Rob

@robertbell robertbell changed the title Headers don't seem to be used when matching requests to cassette responses Headers don't seem to be considered when matching requests to cassette responses Sep 27, 2017
@mleech
Copy link
Owner

mleech commented Sep 27, 2017

Hi,
Unfortunately the request matching is still a bit basic at the moment and only looks at the URL and the HTTP method.
As you mention, using a separate cassette file could be a workaround. Or you could vary the URL by, for example, adding an extra, ignorable query string param.
(I do intend to eventually add some more sophisticated matching - so watch this space)

@robertbell
Copy link
Author

Hey Martin,

That's fair enough. I'll go down the multiple cassette file route for now.

If you ever felt like accepting PRs on this project I'd be more than happy to pick up some tasks. I primarily write C# but I'm sure I could hit the ground running.

Thanks again,

Rob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants