ResponseEntity's HeadersBuilder allows for specifying existing HttpHeaders
Issue: SPR-12324
This commit is contained in:
parent
97596fb9f6
commit
8760be7d64
|
|
@ -256,13 +256,22 @@ public class ResponseEntity<T> extends HttpEntity<T> {
|
|||
|
||||
/**
|
||||
* Add the given, single header value under the given name.
|
||||
* @param headerName the header name
|
||||
* @param headerName the header name
|
||||
* @param headerValues the header value(s)
|
||||
* @return this builder
|
||||
* @see HttpHeaders#add(String, String)
|
||||
*/
|
||||
B header(String headerName, String... headerValues);
|
||||
|
||||
/**
|
||||
* Copy the given headers into the entity's headers map.
|
||||
* @param headers the existing HttpHeaders to copy from
|
||||
* @return this builder
|
||||
* @since 4.1.2
|
||||
* @see HttpHeaders#add(String, String)
|
||||
*/
|
||||
B headers(HttpHeaders headers);
|
||||
|
||||
/**
|
||||
* Set the set of allowed {@link HttpMethod HTTP methods}, as specified
|
||||
* by the {@code Allow} header.
|
||||
|
|
@ -360,6 +369,12 @@ public class ResponseEntity<T> extends HttpEntity<T> {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BodyBuilder headers(HttpHeaders headers) {
|
||||
this.headers.putAll(headers);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BodyBuilder allow(HttpMethod... allowedMethods) {
|
||||
this.headers.setAllow(new HashSet<HttpMethod>(Arrays.asList(allowedMethods)));
|
||||
|
|
|
|||
Loading…
Reference in New Issue