Skip to content

Process HEAD requests as GET#31

Open
sigra wants to merge 1 commit into
railsware:masterfrom
sigra:head_as_get
Open

Process HEAD requests as GET#31
sigra wants to merge 1 commit into
railsware:masterfrom
sigra:head_as_get

Conversation

@sigra

@sigra sigra commented May 28, 2018

Copy link
Copy Markdown

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

ayanko commented May 28, 2018

Copy link
Copy Markdown
Member

Browserstuck

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

@ayanko

ayanko commented May 28, 2018

Copy link
Copy Markdown
Member

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

sigra commented May 28, 2018

Copy link
Copy Markdown
Author

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