Skip to content
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

$client->request('GET', $nonExistantUrl) returns status 200 #67

Open
ChangePlaces opened this issue Jul 25, 2018 · 4 comments
Open

$client->request('GET', $nonExistantUrl) returns status 200 #67

ChangePlaces opened this issue Jul 25, 2018 · 4 comments

Comments

@ChangePlaces
Copy link
Contributor

@ChangePlaces ChangePlaces commented Jul 25, 2018

I've just spent the last few hours trying to figure out why a url that should be 404'ing is returning 200. I assumed it was a problem with the cache, but after dd'ing the response, clearly it isn't. The response contains the normal 404 response text from symfony, but with a 200 status.

reproduce: use a panther client to make a request to a non-existing url, and see the status is 200, instead of 404.

@ChangePlaces
Copy link
Contributor Author

@ChangePlaces ChangePlaces commented Jul 25, 2018

SeleniumHQ/selenium-google-code-issue-archive#141

This, unbelievably is impossible. I can not believe it. There are some 'workarounds' listed in this so post but, still, shocking.

@ChangePlaces
Copy link
Contributor Author

@ChangePlaces ChangePlaces commented Jul 26, 2018

After more research it will never be fixed because selenium mission statement is to reflect what the user will see, and they never see status codes.

This means that returning a status code is wrong. I understand it's necessary to be backwards compatible with web browser / gouette. However, returning a defacto 200 status code is inappropriate. Personally I'm not happy with trying to force Panther to have the same interface as the others - although they do a similar job, they have different use cases, so I see there are two solutions:

  1. Break Panther out and away from the interface, and not return a status code in the Response object,
  2. Use a more appropriate http code rather than the hardcoded 200, so developers aren't testing for 200's and thinking everything is ok when it isn't and force them to understand that testing for response codes with panther is inappropriate. I can't see a suitable http code from this list, but maybe one should be chosen (or informally created) and documented
@dunglas
Copy link
Member

@dunglas dunglas commented Sep 13, 2018

In the meantime, se should at least add a note about that in the docs.

@bpolaszek
Copy link

@bpolaszek bpolaszek commented Sep 12, 2019

Ran into the same issue today, expected a 401 and got a 200.

Since the status code is mandatory into response objects, I follow @ChangePlaces' suggestion to choose a specific, non-standard status code (like Cloudflare's catch-all 520).

The user facing that status code is more likely to google it along with the Panther keyword, hit Panther's documentation, and quickly find out why he's getting a weird status code instead of the expected one.

@dunglas WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants