'Rest-Assured returns the code 400, when a Postman with an identical request is 200
Tell me, there was a problem, the search did not lead to a suitable solution. Briefly: the response code in Rest-Assured for some requests differs from Postman (in postman 200, in RA 400) I tried to set in the config standard UTF-8 with Google, it didn't work out, please tell me how can I do it? Requests - POST config code (2nd line is an extreme attempt to install a charset):
@BeforeEach
void setupRequestSpecBuilder() {
RestAssured.reset();
RestAssured.config = RestAssured.config().decoderConfig(decoderConfig().defaultContentCharset("UTF-8"));
RequestSpecification requestSpec = new RequestSpecBuilder()
.setAccept(ContentType.JSON)
.setContentType(ContentType.ANY)
.build()
.auth()
.basic(login, password)
.header("Accept-Encoding", "gzip, deflate, br");
RestAssured.requestSpecification = requestSpec;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
