I try to use several variants to check 200 Ok HTTP response with Capybara, but non of them doesn't work:
response.should be_success
page.status.should be(200)
page.response.status.should == 200
Is there another one?
A 200 response always has a payload, though an origin server MAY generate a payload body of zero length or empty payload. If server does not want to send any payload in response, then it should send HTTP status 204 (No Content) instead. By default, 200 (OK) response (header and payload) are cacheable.
REST API Tutorial. The HTTP Status 200 (OK) status code indicates that the request has been processed successfully on server. The response payload depends on HTTP method which was selected for request. A 200 response always has a payload, though an origin server MAY generate a payload body of zero length or empty payload.
Important Facts A 200 response always has a payload, though an origin server MAY generate a payload body of zero length or empty payload. If server does not want to send any payload in response, then it should send HTTP status 204 (No Content) instead.
The HTTP Status 200 (OK) status code indicates that the request has been processed successfully on server. The response payload depends on HTTP method which was selected for request. HTTP Status 200 – Response Payload
I found it:
page.status_code.should be 200
And it's work fine!!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With