public static interface ClientResponse.Builder
Modifier and Type | Method and Description |
---|---|
ClientResponse.Builder |
body(reactor.core.publisher.Flux<DataBuffer> body)
Set the body of the response.
|
ClientResponse.Builder |
body(Function<reactor.core.publisher.Flux<DataBuffer>,reactor.core.publisher.Flux<DataBuffer>> transformer)
Transform the response body, if set in the builder.
|
ClientResponse.Builder |
body(String body)
Set the body of the response to the UTF-8 encoded bytes of the given string.
|
ClientResponse |
build()
Build the response.
|
ClientResponse.Builder |
cookie(String name,
String... values)
Add a cookie with the given name and value(s).
|
ClientResponse.Builder |
cookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)
Manipulate this response's cookies with the given consumer.
|
ClientResponse.Builder |
header(String headerName,
String... headerValues)
Add the given header value(s) under the given name.
|
ClientResponse.Builder |
headers(Consumer<HttpHeaders> headersConsumer)
Manipulate this response's headers with the given consumer.
|
ClientResponse.Builder |
rawStatusCode(int statusCode)
Set the raw status code of the response.
|
ClientResponse.Builder |
request(HttpRequest request)
Set the request associated with the response.
|
ClientResponse.Builder |
statusCode(HttpStatus statusCode)
Set the status code of the response.
|
ClientResponse.Builder statusCode(HttpStatus statusCode)
statusCode
- the new status codeClientResponse.Builder rawStatusCode(int statusCode)
statusCode
- the new status codeClientResponse.Builder header(String headerName, String... headerValues)
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
ClientResponse.Builder headers(Consumer<HttpHeaders> headersConsumer)
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.
headersConsumer
- a function that consumes the HttpHeaders
ClientResponse.Builder cookie(String name, String... values)
name
- the cookie namevalues
- the cookie value(s)ClientResponse.Builder cookies(Consumer<MultiValueMap<String,ResponseCookie>> cookiesConsumer)
The map provided to the consumer is "live", so that the consumer can be used to
overwrite existing cookie values,
remove values, or use any of the other
MultiValueMap
methods.
cookiesConsumer
- a function that consumes the cookies mapClientResponse.Builder body(Function<reactor.core.publisher.Flux<DataBuffer>,reactor.core.publisher.Flux<DataBuffer>> transformer)
transformer
- the transformation function to useClientResponse.Builder body(reactor.core.publisher.Flux<DataBuffer> body)
Note: This method will drain the existing body, if set in the builder.
body
- the new body to useClientResponse.Builder body(String body)
Note: This method will drain the existing body, if set in the builder.
body
- the new body.ClientResponse.Builder request(HttpRequest request)
request
- the requestClientResponse build()