Add RFC5987 support for HTTP header field params
This commit adds support for HTTP header field parameters encoding, as
described in RFC5987.
Note that the default implementation still relies on US-ASCII encoding,
as the latest rfc7230 Section 3.2.4 says that:
> Newly defined header fields SHOULD limit their field values to
US-ASCII octets
Issue: SPR-14547
Cherry-picked from: f2faf84f31
This commit is contained in:
@@ -320,6 +320,11 @@ public class HttpHeadersTests {
|
||||
headers.setContentDispositionFormData("name", "filename");
|
||||
assertEquals("Invalid Content-Disposition header", "form-data; name=\"name\"; filename=\"filename\"",
|
||||
headers.getFirst("Content-Disposition"));
|
||||
|
||||
headers.setContentDispositionFormData("name", "中文.txt", Charset.forName("UTF-8"));
|
||||
assertEquals("Invalid Content-Disposition header",
|
||||
"form-data; name=\"name\"; filename*=UTF-8''%E4%B8%AD%E6%96%87.txt",
|
||||
headers.getFirst("Content-Disposition"));
|
||||
}
|
||||
|
||||
@Test // SPR-11917
|
||||
|
||||
Reference in New Issue
Block a user