#7863 Include value of first accept-encoding header where multiple accept-encoding headers are given. (#7864)
Signed-off-by: markslater <mark.slater@mail.com>
This commit is contained in:
parent
0b05425aa5
commit
1f844e8d57
|
@ -339,6 +339,7 @@ public class ResourceService
|
|||
if (headers.hasMoreElements())
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(key.length() * 2);
|
||||
sb.append(key);
|
||||
do
|
||||
{
|
||||
sb.append(',').append(headers.nextElement());
|
||||
|
|
|
@ -1925,6 +1925,16 @@ public class DefaultServletTest
|
|||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_ENCODING, "gzip"));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake gzip"));
|
||||
|
||||
rawResponse = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:br\r\nAccept-Encoding:gzip, compress\r\n\r\n");
|
||||
response = HttpTester.parseResponse(rawResponse);
|
||||
assertThat(response.toString(), response.getStatus(), is(HttpStatus.OK_200));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_LENGTH, "11"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_TYPE, "text/plain"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.VARY, "Accept-Encoding"));
|
||||
assertThat(response, containsHeaderValue(HttpHeader.CONTENT_ENCODING, "br"));
|
||||
body = response.getContent();
|
||||
assertThat(body, containsString("fake brotli"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue