-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Combine query with request body parameters #836
Combine query with request body parameters #836
Conversation
@Crydust thanks for noting this. Will have a look - but i fear i need some coffee to check what is going on here and if we can fix this in a spring-compatible way. So please give me some time to check that. |
This way the return value of `org.htmlunit.WebRequest.getParameters` will better resemble that of a servlet api.
599a2ba
to
6ac12c0
Compare
@rbri Thank you for the super fast reply. I've addressed the checkstyle issues. Let me know if you'd like more clarification or more unittests. I've written a minimal testcase with spring boot here: |
@Crydust looks like your are right ;-) The contract of the method from springs point of view
And from the javadoc itself
There is a lot more missing - look at the last commit. The current plan is to rewrite the WebRequest2Test into a parameterized test - to build a test suite that handles all cases. @Crydust What do you think? |
@Crydust have written the parameterized test... and now we reach the tricky part. the Servlet - getParameters() method only returns the URL parameters for multipart requests. This differs from the expectations in your test case getParametersFromQueryAndUrlEncodedBodyPostWhenEncodingTypeIsMultipart(). You can look at the similar test case with the same name in class WebRequest2Test. Making the implementations of getParameters() closer to the servlet one will break this. Do you have an idea, if this is ok from a spring point of view? |
@Crydust have done all the adjustments to make getParameters() compatible with the output of the servlet method. You can try with the latest snapshot build 4.5.0-SNAPSHOT |
@rbri The build 4.5.0-SNAPSHOT fixes my problem, but unforunately introduces a new problem. I've updated the minimal testcase to use htmlunit 4.5.0-SNAPSHOT. |
@Crydust verry good point, but i checked with the servlet API - will review my tests and check again |
@Crydust To get the values in a real servlet, you have to call getParameterValues(string). Should i add support for this method also? |
@Crydust sorry - my last answer wars total sch.... Let me check again... sorry |
@Crydust ok, you are totally right, my test code was crap and is now fixed. Will provide a new snapshot later today - maybe i can improve the jdoc also |
You're a bit too fast for me to follow. I had just begun writing a pull request. I have used |
sorry - hopefully we are now done with this. A new snapshot build is out. @Crydust Thanks a lot for checking and your PR and.... |
@Crydust what do you think about this
|
@rbri it seems like spring parses the "multipart/form-data" body and includes it's parameters. I've updated the minimal testcase to use the newer htmlunit 4.5.0-SNAPSHOT. |
@Crydust ok, will update my impl and the tests - glad to see me feeling that this is a longer story was correct |
@Crydust snapshot is updated, all your tests passing (at least here). Can you please add tests for other methods than post for multipart requests. I'm not sure what spring requires in this cases. |
I've started working on more tests for other methods, but it's taking a bi tlonger than anticipated. I'll let you know when it's ready. |
I've updated the minimal testcase to use the newer htmlunit 4.5.0-SNAPSHOT. I have previously made a mistake in test 8. I added tests for PUT, DELETE, PATCH and OPTIONS. Some of the tests fail. |
@Crydust thanks a lot, will have a look later and try to fix |
@Crydust ok, made some progress but still 4 tests failing - will investigate this further tomorrow |
@Crydust can you please validate the asserts with a real browser for this tests the path tests are failing because of the order of the parameters and the url params - we have changed the order to make test 8 passing and now this fails.... |
As this pull requestis closed I created a new one. |
This way the return value of
org.htmlunit.WebRequest.getParameters
will better resemble that of a servlet api.Fixes spring-projects/spring-framework#33249