-
Notifications
You must be signed in to change notification settings - Fork 555
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
Error on invalid body #427
Conversation
Perhaps Hash should be supported? How should it be encoded though? JSON, XML? |
That was my original intent when I sat down to write this PR. I would want the Hash to be converted to what ever the For JSON, it's pretty straight forward, for XML it could get complicated (e.g. namespaces). I decided this was too much responsibility for WebMock to take on. Do you have a straightforward implementation in mind? |
Indeed, it may be too much for WebMock. Why do you allow |
There was a test that failed when I didn't :-) It looks like that's how you specify a chunked response in WebMock. |
Indeed, I forgot about it. WebMock really deserves proper documentation instead of one big readme ;) |
I can make a rough draft of some updated in-depth documentation. Did you have a specific framework (like Rspec's relish) in mind? |
I like the minimalistic way http://markevans.github.io/dragonfly/ is done, although I'm not sure what is used there. To be honest, anything will be better than current docs, so I'd be happy with any framework :) |
WebMock fixed argument handling of 'to_return'. Update td-client-ruby's spec to follow the change. The detail is here; bblimke/webmock#427
Why this PR? Right now, users might be confused as to why a hash cannot be accepted as a response body? See Issue bblimke#449 on Github as well as bblimke#427. This seems to have caused considerable consternation to API users - with some spending many frustrated hours searching for a solution. Perhaps it can be solved with a more helpful exception message? This PR hopes to remedy this apparent shortcoming. Perhaps I shall remedy it with an update to the documentation as well. I submit it with the utmost respect to the maintainers and community. Thank you for your efforts, and for reviewing. Ben
It's pretty common for me to try to give a
Hash
to#to_return(body: )
. This results in errors like:It would save debugging time if WebMock raised an error, instead of accepting the Hash. This PR implements that error.