4

I am try to do POST REQUEST to api, let say the API will return a response header in thailand character 10,000 บาท. after i do the request the response i am getting the header value is 10,000 à¸à¸²à¸. Here is the code:

RequestSpecification httpRequest = RestAssured.given().header(HeaderKey.appId,header.getAppId());
Response response = httpRequest.post(uri);
String errMessage = response.header("key-to-value-i-want");
System.out.println(errMessage);

what's missing from my code? Thanks you

Ashish Kamble
  • 2,555
  • 3
  • 21
  • 29
  • also i add this ```RestAssured.config = RestAssured.config().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.ISO_8859_1));``` on top of code didnt work – Hifnie Bilfash Feb 26 '19 at 06:25
  • Make sure your console outputs in the correct encoding – Yassin Hajaj Feb 26 '19 at 07:19
  • Did you try RestAssured.config().decoderConfig(decoderConfig().defaultContentCharset("UTF-8")); http://static.javadoc.io/io.rest-assured/rest-assured/3.3.0/io/restassured/config/DecoderConfig.html – Wilfred Clement Feb 26 '19 at 08:04

0 Answers0