-
Notifications
You must be signed in to change notification settings - Fork 134
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
Support res.format #94
Comments
Same issue! When can we expect a resolution for it? I am stuck because of it and my controller cant be tested without its support? Did you find another alternative @jmnsf meanwhile fix arrives? |
@Vishal-Joshi I've mocked the behaviour, temporarily. Not a very elegant solution since it is heavily coupled to the formats Object provided, but works for the time being. context('given an HTML request', () => {
beforeEach(() => httpMocks.createResponse().format = formats => formats.html()); Doing it in |
What is this 'formats' object? @jmnsf |
The argument to |
No, I am asking about the 'formats' object which you are assigning to httpMocks.createResponse().format? @jmnsf |
I could really use some help on this one. Would either of you like to attempt a pull request with your approach? Tests to explain how it should be used would be great too! |
Signed-off-by: jmnsf <jmnsferreira@gmail.com>
Adds .format to the response object. Closes #94.
res.format
is super useful for having an endpoint that handles multiple Accept headers. Without this, these endpoints can't be tested.The text was updated successfully, but these errors were encountered: