singlebrook / utf8-cleaner

MIT License
277 stars 44 forks source link

Added application/json as a POST body that is sanitized #24

Closed voomify closed 8 years ago

voomify commented 8 years ago

We have a webhook (Shopify) that is posting json using content-type application/json. It fails in the rack middleware with Encoding::CompatibilityError (incompatible character encodings: UTF-8 and ASCII-8BIT). After searching around I found your gem (thank you). I added content-type application/json to the body sanitization case. Now I'm able to parse json properly. Since json is by default UTF-8, I believe this solution is general purpose and could be pulled.

sbleon commented 8 years ago

Thanks, @voomify !

sbleon commented 8 years ago

I've released v0.2.1 that includes this PR.

voomify commented 8 years ago

Excellent. Thank you.

On Tue, Dec 1, 2015 at 11:07 AM, Leon Miller-Out notifications@github.com wrote:

I've released v0.2.1 that includes this PR.

— Reply to this email directly or view it on GitHub https://github.com/singlebrook/utf8-cleaner/pull/24#issuecomment-161014706 .

cosine commented 8 years ago

There was a bug in this PR that causes valid percent characters to be improperly stripped from JSON bodies. I will be submitting a new PR to fix soon.