Package: groovy.http

## [Groovy] Class HttpResult

- groovy.http.HttpResult

-     @Incubating
      @RecordType
      class HttpResult
      extends Object

  Simple response wrapper for the HttpBuilder DSL.

  Parameters:
    `status` - the HTTP status code
    `body` - the buffered response body
    `headers` - the response headers
    `raw` - the underlying JDK response
  Since:
    6.0.0

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `String` | `body`
    `HttpHeaders` | `headers`
    `HttpResponse<String>` | `raw`
    `int` | `status` Simple response wrapper for the HttpBuilder DSL.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `HttpResult(HttpResponse<String> response)` Creates a result wrapper from a JDK HTTP response.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `Object` | `getHtml()` Parses the buffered body as HTML using jsoup when available.
    `` | `Object` | `getJson()` Parses the buffered body as JSON.
    `` | `Object` | `getParsed()` Parses the buffered body according to the `Content-Type` header when possible.
    `` | `Object` | `getXml()` Parses the buffered body as XML.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Property Detail

    - #### final String body

    - #### final HttpHeaders headers

    - #### final HttpResponse<String> raw

    - #### final int status

      Simple response wrapper for the HttpBuilder DSL.

      Parameters:
        `status` - the HTTP status code
        `body` - the buffered response body
        `headers` - the response headers
        `raw` - the underlying JDK response
      Since:
        6.0.0

  - ### Constructor Detail

    - #### HttpResult(HttpResponse<String> response)

      Creates a result wrapper from a JDK HTTP response.

      Parameters:
        `response` - the response to wrap
      Since:
        6.0.0

  - ### Method Detail

    - #### Object getHtml()

      Parses the buffered body as HTML using jsoup when available.

      Returns:
        the parsed HTML document
      Since:
        6.0.0

    - #### Object getJson()

      Parses the buffered body as JSON.

      Returns:
        the parsed JSON value
      Since:
        6.0.0

    - #### Object getParsed()

      Parses the buffered body according to the `Content-Type` header when possible.

      Returns:
        parsed JSON, XML, HTML, or the raw body text
      Since:
        6.0.0

    - #### Object getXml()

      Parses the buffered body as XML.

      Returns:
        the parsed XML value
      Since:
        6.0.0