Markus Schuch created SOLR-12282:
------------------------------------

             Summary: JSONResponseWriter should return Content-Type 
application/javascript for JSONP requests
                 Key: SOLR-12282
                 URL: https://issues.apache.org/jira/browse/SOLR-12282
             Project: Solr
          Issue Type: Improvement
      Security Level: Public (Default Security Level. Issues are Public)
          Components: Response Writers
            Reporter: Markus Schuch


The JSONResponseWriter handles two purposes:
 * writing JSON responses (wt=json)
 * writing JSONP responses, namely JSON responses wrapped by a JavaScript 
function (wt=json&json.wrf=myFunction)

The response writer returns the same Content-Type in both cases. (default: 
application/json)
But for JSONP the correct Content-Type would be "application/javascript".

The response type is configurable, but it is currently not possible to return 
the correct Content-Type in both cases with one configuration at the same time.

The attached patch {{}}{{}}changes the default Content-Type to 
{{application/javascript; charset=utf-8}} for responses with wrapper functions 
(JSONP). If param {{content-type}} is configured, this Content-Type will be 
returned for both JSON and JSONP to ensure backward compatibility.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to