Reputation: 1
Rest assured - API how to use post query string I am unable to pass this. I have to check or uncheck manually.
Instead send data from media type we need to send data with Post query string:
response = given()
.header()
.log()
.when()
.post()
.then()
Upvotes: 0
Views: 62
Reputation: 5917
It's just content-type application/x-www-form-urlencoded
For example:
given().log().all()
.config(RestAssured.config()
.encoderConfig(encoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false)))
.contentType(ContentType.URLENC)
.formParam("name", "john.smith")
.formParam("firstName", "john")
.formParam("lastName", "Smith")
.formParam("email", "[email protected]")
.post("https://postman-echo.com/post")
.prettyPrint();
Upvotes: 1