Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

a user could add the callback on an html page and it will wrap it all…

… with the callback, only needed for JSON
  • Loading branch information...
commit c06d7beb704479225b5448df48afc398daa6dc0a 1 parent 7bf2273
dewski authored sagmor committed
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/rack/jsonp.rb
View
2  lib/rack/jsonp.rb
@@ -24,7 +24,7 @@ def call(env)
env['QUERY_STRING'] = env['QUERY_STRING'].split("&").delete_if{|param| param =~ /^(_|#{@callback_param})/}.join("&")
status, headers, response = @app.call(env)
- if callback
+ if callback && headers['Content-Type'] =~ /json/i
response = pad(callback, response)
headers['Content-Length'] = response.first.length.to_s
headers['Content-Type'] = 'application/javascript'
Please sign in to comment.
Something went wrong with that request. Please try again.