plexus / yaks

Ruby library for building hypermedia APIs
http://rubygems.org/gems/yaks
MIT License
236 stars 26 forks source link

Yaks-sinatra doesn't cause charset to be appended to Content-Type by default #103

Closed fidothe closed 9 years ago

fidothe commented 9 years ago

Sinatra, by default, only adds charset to Content-Type if there isn't an entry in settings.add_charset (see https://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb#L1840 and https://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb#L325-L327.

We were seeing browsers interpret UTF-8 output as Windows-1252 and freaking right out.

The fix was as simple as calling settings.add_charset << 'application/hal+json' (we're using HAL). I think you could easily fix this with the registered callback in the Sinatra::Yaks module. Will send a PR

plexus commented 9 years ago

@fidothe this is fixed, right?

fidothe commented 9 years ago

Yeah, was fixed in #104