I don’t know rails very much and I’m kind of struggling with a post body json string. ContentType headers in the request is set to “application/json; charset=UTF-8” and rails seems to parse it and put it in the parameters.
But my first instinct was to put the body in a string and proxy it to my http client who call an external service, but I got some encoding problem ASCII-8BIT != UTF-8.
If I understand request.body create a StringIO with hardcoded encoding ASCII-8BIT and request.body.string keep that encoding. Is there a reason for that?
So I need to do something like request.body.string.force_encoding(“utf8”) or params.to_json. What would be best practice for this use case?