org.springframework.web.reactive.function.client

## Interface ClientRequest.Builder

Enclosing interface:
  ClientRequest

    public static interface ClientRequest.Builder

Defines a builder for a request.

### Method Summary

All Methods Instance Methods Abstract Methods
`ClientRequest.Builder` `attribute(String name, Object value)` Set the attribute with the given name to the given value.
`ClientRequest.Builder` `attributes(Consumer<Map<String,Object>> attributesConsumer)` Manipulate the request attributes with the given consumer.
`ClientRequest.Builder` `body(BodyInserter<?,? super org.springframework.http.client.reactive.ClientHttpRequest> inserter)` Set the body of the request to the given `BodyInserter`.
`<S,P extends org.reactivestreams.Publisher<S>> ClientRequest.Builder` `body(P publisher, Class<S> elementClass)` Set the body of the request to the given `Publisher` and return it.
`<S,P extends org.reactivestreams.Publisher<S>> ClientRequest.Builder` `body(P publisher, org.springframework.core.ParameterizedTypeReference<S> typeReference)` Set the body of the request to the given `Publisher` and return it.
`ClientRequest` `build()` Build the request.
`ClientRequest.Builder` `cookie(String name, String... values)` Add a cookie with the given name and value(s).
`ClientRequest.Builder` `cookies(Consumer<org.springframework.util.MultiValueMap<String,String>> cookiesConsumer)` Manipulate this request's cookies with the given consumer.
`ClientRequest.Builder` `header(String headerName, String... headerValues)` Add the given header value(s) under the given name.
`ClientRequest.Builder` `headers(Consumer<org.springframework.http.HttpHeaders> headersConsumer)` Manipulate this request's headers with the given consumer.
`ClientRequest.Builder` `method(org.springframework.http.HttpMethod method)` Set the method of the request.
`ClientRequest.Builder` `url(URI url)` Set the url of the request.

### Method Detail

#### method

    ClientRequest.Builder method(org.springframework.http.HttpMethod method)

Set the method of the request.

Parameters:
  `method` - the new method
Returns:
  this builder
Since:
  5.0.1

#### url

    ClientRequest.Builder url(URI url)

Set the url of the request.

Parameters:
  `url` - the new url
Returns:
  this builder
Since:
  5.0.1

#### header

    ClientRequest.Builder header(String headerName,
                                 String... headerValues)

Add the given header value(s) under the given name.

Parameters:
  `headerName` - the header name
  `headerValues` - the header value(s)
Returns:
  this builder
See Also:
  `HttpHeaders.add(String, String)`

#### headers

    ClientRequest.Builder headers(Consumer<org.springframework.http.HttpHeaders> headersConsumer)

Manipulate this request's headers with the given consumer. The headers provided to the consumer are "live", so that the consumer can be used to overwrite existing header values, remove values, or use any of the other `HttpHeaders` methods.

Parameters:
  `headersConsumer` - a function that consumes the `HttpHeaders`
Returns:
  this builder

#### cookie

    ClientRequest.Builder cookie(String name,
                                 String... values)

Add a cookie with the given name and value(s).

Parameters:
  `name` - the cookie name
  `values` - the cookie value(s)
Returns:
  this builder

#### cookies

    ClientRequest.Builder cookies(Consumer<org.springframework.util.MultiValueMap<String,String>> cookiesConsumer)

Manipulate this request's cookies with the given consumer. The map provided to the consumer is "live", so that the consumer can be used to overwrite existing header values, remove values, or use any of the other `MultiValueMap` methods.

Parameters:
  `cookiesConsumer` - a function that consumes the cookies map
Returns:
  this builder

#### body

    ClientRequest.Builder body(BodyInserter<?,? super org.springframework.http.client.reactive.ClientHttpRequest> inserter)

Set the body of the request to the given `BodyInserter`.

Parameters:
  `inserter` - the `BodyInserter` that writes to the request
Returns:
  this builder

#### body

    <S,P extends org.reactivestreams.Publisher<S>> ClientRequest.Builder body(P publisher,
                                                                              Class<S> elementClass)

Set the body of the request to the given `Publisher` and return it.

Type Parameters:
  `S` - the type of the elements contained in the publisher
  `P` - the type of the `Publisher`
Parameters:
  `publisher` - the `Publisher` to write to the request
  `elementClass` - the class of elements contained in the publisher
Returns:
  the built request

#### body

    <S,P extends org.reactivestreams.Publisher<S>> ClientRequest.Builder body(P publisher,
                                                                              org.springframework.core.ParameterizedTypeReference<S> typeReference)

Set the body of the request to the given `Publisher` and return it.

Type Parameters:
  `S` - the type of the elements contained in the publisher
  `P` - the type of the `Publisher`
Parameters:
  `publisher` - the `Publisher` to write to the request
  `typeReference` - a type reference describing the elements contained in the publisher
Returns:
  the built request

#### attribute

    ClientRequest.Builder attribute(String name,
                                    Object value)

Set the attribute with the given name to the given value.

Parameters:
  `name` - the name of the attribute to add
  `value` - the value of the attribute to add
Returns:
  this builder

#### attributes

    ClientRequest.Builder attributes(Consumer<Map<String,Object>> attributesConsumer)

Manipulate the request attributes with the given consumer. The attributes provided to the consumer are "live", so that the consumer can be used to inspect attributes, remove attributes, or use any of the other map-provided methods.

Parameters:
  `attributesConsumer` - a function that consumes the attributes
Returns:
  this builder

#### build

    ClientRequest build()

Build the request.