POST/PATCH html, css & js as JSON values in rails?

20 views
Skip to first unread message

Marvin Danig

unread,
Jan 23, 2016, 4:56:12 AM1/23/16
to Ruby on Rails: Talk
I'm gonna summarise the question here, but the code and detailed situation is best described at StackOverFlow: 

http://stackoverflow.com/questions/34960077/post-patch-html-css-js-as-json-values-in-rails

I'm POSTing/PATCHing a JSON to a rails API endpoint with key-value pairs of HTML, CSS, JS and HEAD. 

The values contain raw html, raw css, raw js with special characters like %, @, &, ; that rails probably doesn't like. The parser is currently removing these special characters and it kind of screws up the data (whole html, whole css and also user generated javascript) by removing % & from in between.

Is there a way to let in incoming JSON as is, through the rails' JSON parser? 


Hassan Schroeder

unread,
Jan 23, 2016, 12:01:53 PM1/23/16
to rubyonrails-talk
On Sat, Jan 23, 2016 at 12:30 AM, Marvin Danig <marvi...@gmail.com> wrote:
> I'm gonna summarise the question here, but the code and detailed situation
> is best described at StackOverFlow:

Not sure why you'd say that, but in any case...

> I'm POSTing/PATCHing a JSON to a rails API endpoint with key-value pairs of
> HTML, CSS, JS and HEAD.
>
> The values contain raw html, raw css, raw js with special characters like %,
> @, &, ; that rails probably doesn't like. The parser is currently removing
> these special characters

Can you show a (minimal) example of the actual JSON being sent?

Have you written a test that demonstrates the failure?

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote
Reply all
Reply to author
Forward
0 new messages