Add ServerRequest::firstHeader
This commit introduces the method firstHeaderiin both WebMvc.fn and WebFlux.fn, which return the first header value of a given header name, if any.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -209,6 +209,8 @@ public class DefaultServerRequestTests {
|
||||
assertThat(headers.acceptCharset()).isEqualTo(acceptCharset);
|
||||
assertThat(headers.contentLength()).isEqualTo(OptionalLong.of(contentLength));
|
||||
assertThat(headers.contentType()).isEqualTo(Optional.of(contentType));
|
||||
assertThat(headers.header(HttpHeaders.CONTENT_TYPE)).containsExactly(MediaType.TEXT_PLAIN_VALUE);
|
||||
assertThat(headers.firstHeader(HttpHeaders.CONTENT_TYPE)).isEqualTo(MediaType.TEXT_PLAIN_VALUE);
|
||||
assertThat(headers.asHttpHeaders()).isEqualTo(httpHeaders);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user