You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Yonik Seeley (JIRA)" <ji...@apache.org> on 2015/03/14 20:02:39 UTC

[jira] [Updated] (SOLR-7217) Auto-detect HTTP body content-type

     [ https://issues.apache.org/jira/browse/SOLR-7217?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley updated SOLR-7217:
-------------------------------
    Attachment: SOLR-7217.patch

Heres a patch.  I reworked it a fair amount rather than just do a straight Heliosearch backport (since in some of my Helio work the goal was to minimize merge conflicts).

- rewrote StandardRequestParser.parseParamsAndFillStreams() for clarity (the big "if" in the previous version was pretty confusion), and commented what I've figured out along the way.
- improved the pattern matching for "restlet paths" /config and /schema
so something like a core name of "schema_free" wouldn't accidentally cause a match.
- form data from curl now autodetects JSON & XML
- StringStream now allows the specification of a content type and only tries to auto-detect if not given.  It also only auto-detects once and remembers it.
- tried to make those easymock based tests a little less fragile

Aside: I discovered that SOLR-6787 changed the behavior of a POST without content type.  Previously it would throw an exception, but now it will use the raw request parser.  Not sure if that was on purpose or not.

> Auto-detect HTTP body content-type
> ----------------------------------
>
>                 Key: SOLR-7217
>                 URL: https://issues.apache.org/jira/browse/SOLR-7217
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Yonik Seeley
>         Attachments: SOLR-7217.patch
>
>
> It's nice to be able to leave off the specification of content type when hand crafting a request (i.e. from the command line) and for our documentation examples.
> For example:
> {code}
> curl http://localhost:8983/solr/query -d '
> {
>   query:"hero"
> }'
> {code}
> Note the missing 
> {code}
> -H 'Content-type:application/json'
> {code}
> that would otherwise be needed everywhere



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org