You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Markus Schuch (JIRA)" <ji...@apache.org> on 2018/04/27 07:05:00 UTC

[jira] [Created] (SOLR-12282) JSONResponseWriter should return Content-Type application/javascript for JSONP requests

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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org