jquery-ujs icon indicating copy to clipboard operation
jquery-ujs copied to clipboard

set request Content-Type for data-remote links

Open santry opened this issue 12 years ago • 16 comments
trafficstars

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 https://github.com/thoughtbot/capybara-webkit/issues/260).

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

santry avatar Jan 28 '13 14:01 santry

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

MDaubs avatar Apr 16 '13 14:04 MDaubs

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

JangoSteve avatar Apr 16 '13 15:04 JangoSteve

+1

amacneil avatar May 01 '13 05:05 amacneil

:+1: this would be very helpful to get out in a new release.

ameketa avatar May 01 '13 15:05 ameketa

+1

andreierdoss avatar May 07 '13 00:05 andreierdoss

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

killthekitten avatar May 24 '13 12:05 killthekitten

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

JangoSteve avatar May 29 '13 04:05 JangoSteve

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?

JangoSteve avatar May 29 '13 05:05 JangoSteve

@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.

santry avatar May 29 '13 17:05 santry

+1

stefanhendriks avatar Jul 17 '13 09:07 stefanhendriks

+1

elangolab avatar Aug 12 '13 14:08 elangolab

+1

rono23 avatar Aug 21 '13 09:08 rono23

+1

jamesconant avatar Aug 21 '13 19:08 jamesconant

+1

gbonvanie avatar Aug 29 '13 20:08 gbonvanie

+1

esbanarango avatar Sep 06 '13 05:09 esbanarango

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

esbanarango avatar Sep 15 '13 15:09 esbanarango