Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1703

GET request should support body

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.5.1
    • 5.0 Alpha1
    • Fluent HC
    • None

    Description

      I have discovered that fluent client does not allow BODY for a get request
      java.lang.IllegalStateException: GET request cannot enclose an entity
      at org.apache.http.client.fluent.Request.body(Request.java:348)
      at org.apache.http.client.fluent.Request.bodyString(Request.java:375)
      at kgi.mcytravel.wsite.services.FullTextSearchService.fullTextSearch(FullTextSearchService.scala:72)

      Which is not correct, spec does not prohibit GET request from having a body. It seems a bit unconventional but makes perfect sense considering complex search requests use case. And it is utilized by ElasticSearch for example

      https://www.elastic.co/guide/en/elasticsearch/reference/current/search.html

      curl -XGET 'http://localhost:9200/twitter/tweet/_search?routing=kimchy' -d '{
      "query": {
      "bool" : {
      "must" : {
      "query_string" :

      { "query" : "some query string here" }

      },
      "filter" : {
      "term" :

      { "user" : "kimchy" }

      }
      }
      }
      }
      '

      Attachments

        Activity

          People

            Unassigned Unassigned
            kgignatyev Konstantin Ignatyev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: