Given this Spring application to download:
@SpringBootApplication
@RestController
public class ShowCase {
public static void main(String[] args) {
SpringApplication.run(ShowCase.class, args);
}
@RequestMapping(value = "submit", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public void getFormKeys(@RequestBody MultiValueMap<String, String> formData) {
System.out.println(formData.keySet().stream().collect(joining(",")));
}
}
And this curl request:
curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" --data "arg1=val&arg2=val" http://localhost:8080/submit
Using Spring Boot 1.2.5, the method is called correctly and prints the form keys.
With Spring Boot 1.3.8, the method is not called, but a warning is written instead:
WARN 17844 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public void web.ShowCase.getFormKeys(org.springframework.util.MultiValueMap<java.lang.String, java.lang.String>)
What is needed in Spring Boot 1.3.8 for this PUT request to work again?
source
share