Package: groovy.http

## [Groovy] Class HttpBuilder.Config

- groovy.http.HttpBuilder.Config

-     static final class HttpBuilder.Config
      extends Object

  Configuration DSL used to create an HttpBuilder.

  Since:
    6.0.0

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `URI` | `baseUri` Absolute base URI used to resolve relative request URIs.
    `Closure<?>` | `clientConfigurer` Optional hook for advanced HttpClient.Builder customization.
    `boolean` | `confineToBaseUri` Whether request URIs are confined to baseUri.
    `Duration` | `connectTimeout` Timeout applied when opening connections.
    `boolean` | `followRedirects` Whether redirects should be followed automatically.
    `Map<String, String>` | `headers` Headers added to every request created by the builder.
    `Duration` | `requestTimeout` Timeout applied to each request when not overridden.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `HttpBuilder.Config()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `baseUri(Object value)` Sets the absolute base URI used for relative requests.
    `` | `void` | `clientConfig(Closure<?> configurer)` Provides direct access to the underlying `HttpClient.Builder` for advanced configuration (authenticator, SSL context, proxy, cookie handler, etc.).
    `` | `void` | `confineToBaseUri(boolean value)` Confines every request to the configured baseUri.
    `` | `void` | `connectTimeout(Duration value)` Sets the client connect timeout.
    `` | `void` | `followRedirects(boolean value)` Enables or disables automatic redirect following.
    `` | `void` | `header(String name, Object value)` Adds a default header to every request.
    `` | `void` | `headers(Map<String, ?> values)` Adds multiple default headers to every request.
    `` | `void` | `requestTimeout(Duration value)` Sets the default request timeout.

  - ### Inherited Methods Summary

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

- - ### Property Detail

    - #### URI baseUri

      Absolute base URI used to resolve relative request URIs.

    - #### Closure<?> clientConfigurer

      Optional hook for advanced HttpClient.Builder customization.

    - #### boolean confineToBaseUri

      Whether request URIs are confined to baseUri. When enabled, requests that resolve to a different origin (scheme, host, or effective port) or escape the base path prefix are rejected with a SecurityException. Requires `baseUri` to be configured.

    - #### Duration connectTimeout

      Timeout applied when opening connections.

    - #### boolean followRedirects

      Whether redirects should be followed automatically.

    - #### final Map<String, String> headers

      Headers added to every request created by the builder.

    - #### Duration requestTimeout

      Timeout applied to each request when not overridden.

  - ### Constructor Detail

    - #### HttpBuilder.Config()

  - ### Method Detail

    - #### void baseUri(Object value)

      Sets the absolute base URI used for relative requests.

      Parameters:
        `value` - the base URI as a URI or coercible string

    - #### void clientConfig(@DelegatesTo(value=HttpClient.Builder, strategy=Closure.DELEGATE_FIRST)
      Closure<?> configurer)

      Provides direct access to the underlying `HttpClient.Builder` for advanced configuration (authenticator, SSL context, proxy, cookie handler, etc.).

      Parameters:
        `configurer` - a closure taking an `HttpClient.Builder`

    - #### void confineToBaseUri(boolean value)

      Confines every request to the configured baseUri. Absolute request URIs pointing at another origin, and relative URIs that walk above the base path (e.g. via `..` or a leading `/`), are rejected with a SecurityException instead of being executed.

      Parameters:
        `value` - `true` to reject requests that escape the base URI

    - #### void connectTimeout(Duration value)

      Sets the client connect timeout.

      Parameters:
        `value` - the connection timeout

    - #### void followRedirects(boolean value)

      Enables or disables automatic redirect following.

      Parameters:
        `value` - `true` to follow redirects

    - #### void header(String name, Object value)

      Adds a default header to every request.

      Parameters:
        `name` - the header name
        `value` - the header value

    - #### void headers(Map<String, ?> values)

      Adds multiple default headers to every request.

      Parameters:
        `values` - the headers to add

    - #### void requestTimeout(Duration value)

      Sets the default request timeout.

      Parameters:
        `value` - the request timeout