Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gnidan/rack-json_response_wrapper

Rack Middleware for JSON APIs accessed cross-domain from legacy browsers
https://github.com/gnidan/rack-json_response_wrapper

Last synced: 23 days ago
JSON representation

Rack Middleware for JSON APIs accessed cross-domain from legacy browsers

Awesome Lists containing this project

README

        

rack-json_response_wrapper
==========================

Rack Middleware for JSON APIs accessed cross-domain from legacy browsers

Firefox versions <4 does not support response headers for cross-domain requests. This middleware intercepts all requests and if the X-WRAP-RESPONSE is set, the response will be wrappped in JSON as follows:

Suppose the following is the original response body:

{"key": "value"}

With X-WRAP-RESPONSE set to true, the new response will be:

{
"header": { ... bunch of headers ... },
"body": {"key": "value"}
}