-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parameter values are null when making a PUT request [SPR-15828] #20383
Comments
Juergen Hoeller commented This looks like a side effect of #20308; however, that's a 4.3.10-only change. Are you sure this happens with 4.3.9 as well? In any case, let's sort this out for 4.3.11, one way or the other. |
Petar Tahchiev commented Hi Juergen, |
Rossen Stoyanchev commented I presume this is when the application is running? In other words just double checking it's not a MockMvc test. The intent of |
Petar Tahchiev commented Yes, this happens when the application is running and I submit a PUT form. |
Petar Tahchiev commented I stopped with breakpoint in |
Rossen Stoyanchev commented Request parameters are a Servlet API concept (no such thing in HTTP). The are sourced from URI query parameters, from form data in the request body, or parts in the body of a multipart form request. So I am first of all wondering what is the source of correct value, i.e. what does it correspond to in the actual HTTP request that came in? Or does it not correspond to anything and it was added later, e.g. possibly by decorating the request? |
Jonas Havers commented The values are contained in the request parameters, just like defined in In the I do not know the reason why the "getBody" method is overridden. In the
The request wrappers at
|
Rossen Stoyanchev commented Yes based on #20390 one possible explanation for this ticket here is that actual underlying request method is HTTP POST and the body would have already been parsed by the Servlet container. So the assumption that Petar Tahchiev can you confirm that your case is a request coming from a browser where the form has the |
Vedran Pavic commented We were also affected by this, however while updating from
This has been our case - it's a Spring Boot application so both I've tested the |
Rossen Stoyanchev commented Thanks for checking. |
Petar Tahchiev opened SPR-15828 and commented
Hello,
here's the setup. I have a controller which is mapped to
PUT
request method. Spring-boot configuresHttpPutFormContentFilter
and in 4.3.8 the method inHttpPutFormContentRequestWrapper:getParameterValues
looks like this:So because
super.getParameterValues(name)
returns correct value and theformParameters.get(name)
returns null, the the correct value fromqueryStringValues
is returned.Now in 4.3.9 this method looks like this:
Now because the
super.getQueryString()
is null and theformParam
is null too then null is returned.Why has this been changed? Do I need to change my forms too? I was assuming my code should work in both 4.3.8 and 4.3.9
Affects: 4.3.10, 5.0 RC3
Attachments:
Issue Links:
@RequestParam
within form PUT request handlers is broken (HttpPutFormContentFilter) ("is duplicated by")Referenced from: commits 3524849, af83d23
0 votes, 5 watchers
The text was updated successfully, but these errors were encountered: