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

Feature Request: Allow wildcard for headers #12

Open
taylorjdawson opened this issue Sep 26, 2018 · 2 comments
Open

Feature Request: Allow wildcard for headers #12

taylorjdawson opened this issue Sep 26, 2018 · 2 comments

Comments

@taylorjdawson
Copy link
Contributor

taylorjdawson commented Sep 26, 2018

There should be an option to allow a wildcard for certain header attributes. I have an api key in a header but I want ava-playback to ignore it like similar to your example here but this only works for query params not headers.

Related to: #11.

@dempfi
Copy link
Owner

dempfi commented Sep 26, 2018

Hi @taylorjdawson, this is an interesting use case. Headers are really tricky and easy to mess up with. let me do a little research on this subject.

Also, if let's say all headers are ignored, will it work for you or you need some to be matched and some not?

@taylorjdawson
Copy link
Contributor Author

@dempfi So the ability to ignore headers would enable me to use an arbitrary api-key. However, I do really like that idea of matching requests based on all factors including headers. So here's some options:

Option Pro Con
ignore headers Simple Reduces the level of specificity for requests.1 Can not validate header attributes in request.2
add a wild card option Affects only 1 header attribute. Still accounts for other headers More complicated implementation (I'm guessing). Can not validate the wildcard header attribute in request.3
hard code a header attribute and match against that Able to validate the header attribute. It will reject request if header doesn't match exactly.4 More complicated implementation (I'm guessing).
  1. Two requests with different headers could be considered the same request
  2. i.e. if you send the wrong headers it will accept the request which isn't a good idea.
  3. i.e. if you send the wrong apikey it will still accept the request which isn't a good idea.
  4. This is how it is currently setup. However, just need to add an option to specify a single header attribute that you want to match against. I.e. I use a real apikey for my live requests but when running on fixtures I want to use a dumby key that I made up.

Let me know what you think and if you need further clarification 👍

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