Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-380

Support for HTTP Delete with entity body

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.4-alpha1
    • 5.0-alpha1
    • HttpCore, HttpCore NIO
    • None

    Description

      Hi All,

      I have created a fix to support HTTP DELETEs with entity bodies. In HTTP Core, the HttpRequest object (BasicHttpRequest or BasicHttpEntityEnclosingRequest) is made by looking at the HTTP method. But sometimes an API could accept HTTP Deletes with payloads for example [1]. To support this I have introduced a new type of HTTP requests "HttpEntityPossibleEnclosingRequest". By calling the "getFinalHttpRequest" method in this class, the proper HTTP request object can be made, i.e. HttpRequest or HttpEntityEnclosingRequest. The logic is if the HttpEntityPossibleEnclosingRequest has the CONTENT_LENGTH header, an HttpEntityEnclosingRequest is made and an HttpRequest is made otherwise.

      Note. the spec does not prohibit an HTTP Delete having a payload [2] [3].

      [1] http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-delete-by-query.html
      [2] http://stackoverflow.com/a/299696/1411653
      [3] http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7

      Thanks,
      Jeewantha

      Attachments

        1. httpcore-nio.diff
          1 kB
          Jeewantha Dharmaparakrama
        2. httpcore.diff
          7 kB
          Jeewantha Dharmaparakrama

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            jeewamp Jeewantha Dharmaparakrama
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment