Rest Assured doesn't support web form posting "application/x-www-form-urlencoded"
See original GitHub issueWHEN I post a request for authentication, the error occurs to say that:
“java.lang.IllegalArgumentException: Cannot serialize because cannot determine how to serialize content-type application/x-www-form-urlencoded;charset=UTF-8”
Here is my test method
@Test
public void authenticate()
{
AuthenDto authenDto = new AuthenDto("username","password","false","Login");
given()
.contentType("application/x-www-form-urlencoded;charset=UTF-8")
.accept("application/json, text/plain, */*")
.body(authenDto)
.when()
.post("ENDPOINT")
.then()
.statusCode(200);
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (1 by maintainers)
Top Results From Across the Web
How to post x-www-urlencode request by rest assured
3.I find the type "ContentType.URLENC" only without " ContentType.APPLICATION_FORM_URLENCODED".It seems that put msg in body is not right ...
Read more >How to Submit Form Data With REST-assured Post Request
HTML Forms use POST request to submit form data and in this tutorial, we use REST-assured to submit a form. A POST request...
Read more >Understanding POST request method using Rest Assured
As we learned from the above example, the POST method usually creates a new record in the application database. Although, it is not...
Read more >How to send x-www-form-urlencoded keyValue pair parameters
post ("/111"); When i check RestAssured logs it shows all parameters in Form params but parameters are sent as form-data not as x-www-form- ......
Read more >Difference Between form-data, x-www-form-urlencoded and ...
We can use the raw data type to send any type of data in the request body. This also includes sending the Javascript...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since the content-type is “x-www-form-urlencoded”, Instead of using ‘body’ tag, use the ‘formparam’ tag in the request.
Ex: Replace body(“Example”,“ExValue”) with formParam(“formParamName”, “value1”).
Let to know whether if it works.
@medineshkumar it works with
formParam