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

change scope of ContentResponseHandler or provide an alternative

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.4 Final
    • Fluent HC
    • None

    Description

      As a developer using the apache fluent hc library I need to be able to get back both the http status code and the http response body.

      When I try to do this now, I get an exception that "Response content has been already consumed".

      The only way to get around this is to go back to the non-fluent api and get the HttpResponse, pull the entity, check it, etc. This is already done in ContentResponseHandler and is a clear DRY violation.

      It would be much cleaner to expose ContentResponseHandler as a public class, so that it can be overriden, called from handleContent, etc. Or to add a new ResponseHandler that also provides other details like the response code.

      Consider these stackoverflow questions as I'm not the only one who desires this:

      http://stackoverflow.com/questions/22409303/is-it-possible-to-get-both-the-status-code-and-the-body-content-when-using-apach

      http://stackoverflow.com/questions/14024625/how-to-get-httpclient-returning-status-code-and-response-body

      Attachments

        Activity

          People

            Unassigned Unassigned
            javamonkey79 Shaun A Elliott
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: