-
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
WebMock::Response::InvalidBody #428
Comments
@alexfalkowski yes, please see #427 It's ambiguous how the hash should be encoded. JSON, XML, url-encoded? Could you please share an example that used to work for you? I'm surprised it did before :) /cc @dapplebeforedawn |
A simplified version of the code json = JSON.parse "{}"
stub_request(:post, "www.example.com").with(body: json) Looking at the tests I see that it is silly doing it this way, though it works. I might have to rewrite the tests. |
This code only declares request body for the stub, not the response body. It would not be affected by the change in 1.20.2 |
When I am in front of the code I will post up the example (might be getting something wrong). |
So looking at the code we do the following: json = JSON.parse "{}"
stub_request(:get, url).to_return(body: json) |
I will see if I can rewrite the tests :) |
I have managed to rewrite the tests, due to this change it made mew realise the tests were wrong. Thanks guys :) |
That makes me very happy. What just happened to you is the reason I wrote |
Thanks mate 😃 |
Upgrading from version 1.20.0 to 1.20.2 I now get:
WebMock::Response::InvalidBody: must be one of: [Proc, IO, Pathname, String, Array]. 'Hash' given. Is this by design?
The text was updated successfully, but these errors were encountered: