Rails-jQuery-Demo icon indicating copy to clipboard operation
Rails-jQuery-Demo copied to clipboard

Add spec showing parse error when request is json

Open jnimety opened this issue 14 years ago • 4 comments

This is a test case for issue #3

jnimety avatar Nov 18 '11 04:11 jnimety

that's issue 3 in the remotipart repo https://github.com/JangoSteve/remotipart/issues/3

jnimety avatar Nov 18 '11 04:11 jnimety

Thanks @jnimety, I appreciate the test case. However, the reason you are getting a javascript response is because the form doesn't have data-type="json". This is not an issue with remotipart, it's how rails/jquery-ujs does it.

JangoSteve avatar Nov 18 '11 04:11 JangoSteve

Thanks, I've updated the test to use data-type and it passes, I can't believe I missed that requirement these past few weeks.

I also added a test showing that data-type is not required if there is no attachment, this is still jquery-ujs right? Why is data-type only required if remotipart is used?

jnimety avatar Nov 18 '11 12:11 jnimety

I have no idea to be honest. It might be a difference in the way that rails ActionDispatch handles xhr and normal requests differently (i.e. maybe it treats the extension differently between xhr and normal requests). The only difference between remotipart request and normal jquery-ujs requests, is that remotipart is not xhr, it's a normal request/response from an iframe.

JangoSteve avatar Nov 19 '11 04:11 JangoSteve