Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure Taps version of OkJson is used to properly encode data #133

Closed
wants to merge 1 commit into from

Conversation

eric1234
Copy link
Contributor

Taps uses a customized version of OkJson to exchange data between the client
and server. This customized version silently converts symbols to strings
as a convience (the original OkJson considers encoding symbols an error since
symbols are not a type supported by JSON).

Rack started using OkJson also to encode data but kept the original symantics.
Since the Taps::Server inherits from Sinatra::Base, and Sinatra::Base includes
Rack::Utils, and Rack::Utils is the namespace where Rack's version of OkJson
is installed this means the Rack version is now being used by taps instead of
the taps version. This means when symbols are encoded an error is generated.

To restore the original behavior this patch explicility references the taps
version of OkJson.

This fixes issue #128.

Taps uses a customized version of OkJson to exchange data between the client
and server. This customized version silently converts symbols to strings
as a convience (the original OkJson considers encoding symbols an error since
symbols are not a type supported by JSON).

Rack started using OkJson also to encode data but kept the original symantics.
Since the Taps::Server inherits from Sinatra::Base, and Sinatra::Base includes
Rack::Utils, and Rack::Utils is the namespace where Rack's version of OkJson
is installed this means the Rack version is now being used by taps instead of
the taps version. This means when symbols are encoded an error is generated.

To restore the original behavior this patch explicility references the taps
version of OkJson.

This fixes issue ricardochimal#128.
@tigrish
Copy link

tigrish commented Jul 20, 2013

👍 This would have fixed a lot of headaches

@wijet
Copy link

wijet commented Oct 24, 2013

I've created taps-taps gem which includes your fix. Thanks!

@eric1234
Copy link
Contributor Author

@wijet - Your my hero for putting together a fork of this software with everybody's patches. It too useful of software to let die just because Heroku has moved away from it but didn't have time to maintain a fork myself. Thanks!

@mijoharas
Copy link

ahh, I just used the ugly uninstall then reinstall rack hack to get around this. nice one @wijet !

@joelvh
Copy link

joelvh commented Apr 7, 2017

@eric1234 this was implemented in taps2 version of this gem

@eric1234 eric1234 closed this Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants