Revert "Always specify charset for form data requests"
This reverts commit 1897d8e858.
Issue: SPR-16613
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -22,6 +22,7 @@ import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
@@ -30,6 +31,7 @@ import org.apache.commons.fileupload.FileItemFactory;
|
||||
import org.apache.commons.fileupload.FileUpload;
|
||||
import org.apache.commons.fileupload.RequestContext;
|
||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -45,10 +47,14 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.CoreMatchers.endsWith;
|
||||
import static org.hamcrest.CoreMatchers.startsWith;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.BDDMockito.never;
|
||||
import static org.mockito.BDDMockito.verify;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
@@ -116,8 +122,8 @@ public class FormHttpMessageConverterTests {
|
||||
|
||||
assertEquals("Invalid result", "name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3",
|
||||
outputMessage.getBodyAsString(UTF_8));
|
||||
assertEquals("Invalid content-type", "application/x-www-form-urlencoded;charset=UTF-8",
|
||||
outputMessage.getHeaders().getContentType().toString());
|
||||
assertEquals("Invalid content-type", new MediaType("application", "x-www-form-urlencoded"),
|
||||
outputMessage.getHeaders().getContentType());
|
||||
assertEquals("Invalid content-length", outputMessage.getBodyAsBytes().length,
|
||||
outputMessage.getHeaders().getContentLength());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -168,7 +168,7 @@ public class AbstractMockWebServerTestCase {
|
||||
}
|
||||
|
||||
private MockResponse formRequest(RecordedRequest request) {
|
||||
assertEquals("application/x-www-form-urlencoded;charset=UTF-8", request.getHeader("Content-Type"));
|
||||
assertEquals("application/x-www-form-urlencoded", request.getHeader("Content-Type"));
|
||||
String body = request.getBody().readUtf8();
|
||||
assertThat(body, Matchers.containsString("name+1=value+1"));
|
||||
assertThat(body, Matchers.containsString("name+2=value+2%2B1"));
|
||||
|
||||
Reference in New Issue
Block a user