Permalink
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...
1 parent 7bf2273 commit c06d7beb704479225b5448df48afc398daa6dc0a dewski committed with sagmor Aug 30, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/rack/jsonp.rb
View
@@ -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'

0 comments on commit c06d7be

Please sign in to comment.