Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP response 200 with Capybara

Tags:

capybara

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?

like image 563
Leo Lukin Avatar asked Jan 31 '13 18:01

Leo Lukin


People also ask

What is the payload of a 200 a 200 response?

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.

What is the meaning of 200 OK in REST API?

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.

What is the difference between 200 and 204 response?

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.

What is the meaning of the HTTP status 200?

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


1 Answers

I found it:

page.status_code.should be 200

And it's work fine!!!

like image 75
Leo Lukin Avatar answered Oct 18 '22 01:10

Leo Lukin