forked from HtmlUnit/htmlunit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP HtmlUnit#223 Sending AJAX POST Requests with x-www-form-urlencoded
added another "default" case into the prepareRequestContext method for POST, PATH and PUT requests. If no other condition holds and before putting the content into the request body we now check if the encoding of the request is "application/x-www-form-urlencoded", parse the content and put the values into the request parameters. Those request parameters are later used by Springs RequestParamMethodArgumentResolver if htmlunit is running with MockMvc under the hood. This is necessary as there is no parsing of the body involved in Spring MockMvc. The implementation now behaves as it would if the javascript code passed a FormData instance as content. This should also work when htmlunit runs on apaches http client as HttpWebConnection will use the requestParameters for POST requests and recreate the urlencoded form body. The HttpWebConnection was also changed to do this for PATCH and PUT also if the encoding is application/x-www-form-urlencoded WIP: as I wasn't able to run all the tests yet
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters