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

Cache to match on request headers #203

Closed
Anujan opened this issue Jun 13, 2016 · 5 comments
Closed

Cache to match on request headers #203

Anujan opened this issue Jun 13, 2016 · 5 comments

Comments

@Anujan
Copy link

Anujan commented Jun 13, 2016

Is it possible to allow for certain headers to be matched on? For example, I'd like to hit the same URL with two different auth headers, have it return different data and cache both responses. The current behavior seems to overwrite the previous cache result if the URLs match.

@mogronalol
Copy link
Contributor

mogronalol commented Jun 13, 2016

Right now we ignore headers, because depending on your client different ones may be generated alongside your requests - you'd have to be specific about which subset of headers you want to match on.

It does seem reasonable that different test users might require different responses for the same endpoint. You could always spin up one hoverfly per user though and load different data into it. We should look into this further.

@mozey
Copy link

mozey commented Jun 13, 2016

Just a thought. What about making the hash function that is used to create the key for looking up the response an optional argument to hoverfly? Similar to how middleware is passed in.

@Anujan
Copy link
Author

Anujan commented Jun 13, 2016

Hmm, yeah, I was hoping for it to be something similar to Wiremock's --match-headers argument which allows you to pass headers that you'd want to match on

@mogronalol
Copy link
Contributor

We could do that, it would be quite a large change - I think this is a wider problem space of partial matching in general, on all parts of the request. Right now there is good performance from using key value lookups but matching probably needs to be optionally looser.

@benjih
Copy link
Contributor

benjih commented Oct 1, 2016

Hey @Anujan

Since this ticket, we've introduced a the ability to create request templates that allow you to optionally match on any part of a request, including headers.

This isn't the same as changing the hashing algorithm to include headers but it does achieve the same result.

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

No branches or pull requests

6 participants