-
Notifications
You must be signed in to change notification settings - Fork 27
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
WithResponseHeaders and WithContentHeaders overloads #473
Comments
Prototype implementation to support justeattakeaway#473.
I've pushed up a commit with a prototype/proof-of-concept of how this might work here: martincostello@fb9440d Let me know if this would address your use case, and if it seems workable I can look at fleshing it out. |
Thanks @martincostello! That looks perfect for my use case, and it seems like a very elegant solution. Perhaps some async overload might be useful (like there already is for |
Cool - glad it works for your use case. I left out async to start with to get some fast feedback, however given the current internal design I don't know if it could be easily added or not. I'll consider it, but leave it out if it requires too much rework - it could always be added at a later date in a new major version if there's demand for it. I'll look at circling back to this change and fleshing it out some time this week. Once I do that I'll push up a pull request, and you should be able to validate it via a preview NuGet package via the GitHub Actions CI to validate it before it goes into a release shipped to NuGet.org. |
- Add support for dynamically matching and producing HTTP headers. - Add missing null check. Relates to justeattakeaway#473.
Thanks @martincostello. I've tested it and it works great! |
Thanks - I'll come back to finishing this off and prepping a release including the change next week when I'm back in the office. |
Prototype implementation to support justeattakeaway#473.
- Add support for dynamically matching and producing HTTP headers. - Add missing null check. Relates to justeattakeaway#473.
This change is now available from NuGet.org. |
Is your feature request related to a problem? Please describe.
I have an extension method which allows me to register responses for intercepted requests such that each subsequent request that matches, returns a different response content. I do this by using a closure of a
Counter
object, which gets incremented usingWithInterceptionCallback
, as follows:I would like to do the same for the response headers and content headers as well. This requires new overloads for
WithResponseHeaders
andWithContentHeaders
, and some associated code changes.Describe the solution you'd like
New overloads for
WithResponseHeaders
andWithContentHeaders
, which allow passing aFunc<IDictionary<string, ICollection<string>>>
.Describe alternatives you've considered
No alternatives exist.
Additional context
The reason for requiring different responses to the same request is that the API being "mocked" is one that returns data which changes over time. My test suite is set up so that I can verify this behaviour.
The text was updated successfully, but these errors were encountered: