Skip to content

set request Content-Type for data-remote links#301

Open
santry wants to merge 1 commit intorails:masterfrom
santry:add_content_type_to_data_remote
Open

set request Content-Type for data-remote links#301
santry wants to merge 1 commit intorails:masterfrom
santry:add_content_type_to_data_remote

Conversation

@santry
Copy link
Copy Markdown

@santry santry commented Jan 28, 2013

This pull request sets the Content-Type header to 'application/x-www-form-urlencoded; charset=UTF-8' for Ajax requests generated for links with data-remote="true" and data-method="post".

Without this patch, no Content-Type header is included in the requests that jquery-ujs generates for these links. Tools such as capybara-webkit issue repeated warnings about these missing headers and these warnings clutter the display of test results (see thoughtbot/capybara-webkit#260).

I've added an appropriate test that passes on Chrome, Safari, Firefox and IE 7-10.

@MDaubs
Copy link
Copy Markdown

MDaubs commented Apr 16, 2013

We are also seeing this issue and have resorted to patching our applications. This seems like something that should definitely be merged upstream.

@JangoSteve
Copy link
Copy Markdown
Member

Good deal. Thanks for the test! I'll pull this in, and release a new jquery-rails gem soon.

@amacneil
Copy link
Copy Markdown

amacneil commented May 1, 2013

+1

@ameketa
Copy link
Copy Markdown

ameketa commented May 1, 2013

👍 this would be very helpful to get out in a new release.

@andreierdoss
Copy link
Copy Markdown

+1

@killthekitten
Copy link
Copy Markdown

+1, this annoying stuff should be fixed 👍 /cc @JangoSteve how's it going?

@JangoSteve
Copy link
Copy Markdown
Member

I can't get this test to fail in the old version of jquery-ujs. I think I may be missing something.

@JangoSteve
Copy link
Copy Markdown
Member

I deleted the change to rails.js and just kept the test, ran it in Chrome, Firefox, Safari, and IE9, and the test passed on all. What browser were you running it on where it failed?

@santry
Copy link
Copy Markdown
Author

santry commented May 29, 2013

@JangoSteve the failure happens in capybara-webkit. I didn't want to introduce that dependency into the project so I didn't include it with this pull request.

@stefanhendriks
Copy link
Copy Markdown

+1

@elangolab
Copy link
Copy Markdown

+1

4 similar comments
@rono23
Copy link
Copy Markdown

rono23 commented Aug 21, 2013

+1

@jamesconant
Copy link
Copy Markdown

+1

@gbonvanie
Copy link
Copy Markdown

+1

@esbanarango
Copy link
Copy Markdown

+1

@esbanarango
Copy link
Copy Markdown

what's the status on this? will it be merged?...

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.