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

Process HEAD requests as GET #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sigra
Copy link

@sigra sigra commented May 28, 2018

When I'm using remote browser (such as Browserstuck) my tests are failed with the following message:

#<ActionController::RoutingError: No route matches [HEAD] "/rack_session/edit">

Rails had the same issue with HEAD requests and it was fixed here: rails/rails#19431 . So, they just process HEAD requests as GET.

P.S. I really don't know how to cover this case with RSpec and I would appreciate if you give me an advice.

@ayanko
Copy link
Member

ayanko commented May 28, 2018

Browserstuck

BrowserStack perhaps ? Interesting why they do HEAD instead of GET. Any extra info?

@ayanko
Copy link
Member

ayanko commented May 28, 2018

I really don't know how to cover this case with RSpec

I believe ( ⛪️ ) we can test it against rack_test driver here:

https://github.com/railsware/rack_session_access/blob/master/spec/middleware_spec.rb#L135-L153

using page.driver.browser.head() instead of visit.

Looks like head is not exposed as api method by cabybara because usually you can't do it in real browser as user.

More info:

@sigra
Copy link
Author

sigra commented May 28, 2018

Thank you for response, @ayanko !

BrowserStack perhaps ?

Oh, yes, BrowserStack of course. 😬

Interesting why they do HEAD instead of GET. Any extra info?

They don't use HEAD instead of GET. They use both of them. Request order in my log file looks like:

Started GET "/rack_session/edit" for 127.0.0.1 at 2018-05-28 17:29:15 +0400
Started PUT "/rack_session" for 127.0.0.1 at 2018-05-28 17:29:19 +0400
Started HEAD "/rack_session/edit" for 127.0.0.1 at 2018-05-28 17:29:20 +0400

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

Successfully merging this pull request may close these issues.

2 participants