Open GoogleCodeExporter opened 9 years ago
Thanks for reporting, looks like an encoding issue.
Original comment by johan.ha...@gmail.com
on 5 Jul 2014 at 5:02
If it helps, I am getting the same problem with the following code :
final String url = "http://localhost:80/api/movies/one/abc123;
final String expectedTitle = "La confrérie des larmes";
// Act
final RequestSpecBuilder builder = new RequestSpecBuilder();
builder.addHeader("Accept", "application/json");
final RequestSpecification requestSpec = builder.build();
given()
.spec(requestSpec)
.get(url)
.then()
.body("content.title", is(expectedTitle));
The Stack trace says: JSON path content.title doesn't match. Expected: is "La
confrérie des larmes" Actual: La confrérie des larmes
And if I try the following code :
final ResponseBody body = given() //
.spec(requestSpec) //
.get(url)//
.body();
Assert.assertEquals(expectedTitle, body.path("content.title"));
The stack trace says: expected:<La confr[é]rie des larmes> but was:<La
confr[é]rie des larmes>
Original comment by thierry...@gmail.com
on 22 Sep 2014 at 1:39
Tested with 2.3.3
Original comment by thierry...@gmail.com
on 22 Sep 2014 at 1:41
[deleted comment]
Are you providing any data to the server as well? In that case have you tried
specifying a charset with the content-type?
If not, do you know what charset the server returns? Does the server specify
the charset in the content-type header? If I remember things correctly REST
Assured uses default system charset if a charset is not specified in the
response. You can change that to another charset using the DecoderConfig
(https://code.google.com/p/rest-assured/wiki/Usage#Decoder_Config). For example:
RestAssured.config =
RestAssured.config().decoderConfig(decoderConfig().defaultContentCharset("UTF-8"
));
Original comment by johan.ha...@gmail.com
on 23 Sep 2014 at 6:51
Original issue reported on code.google.com by
arnel.hemady
on 24 Jun 2014 at 10:06