liuedx / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

Setting custom header with non ascii character displaying garbled character #417

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try setting custom meatadata header to any URL with non ascii character it 
will display garbled character.

2. Code snippet
        expect().
            statusCode(204).
        given().
          contentType(text/html;charset=UTF-8).
            header("X-Auth-Token", authToken).
            header("X-Account-Meta-TEST", abc).
            header("X-Account-Meta-TEST", "μεταδεδομένα").
            post(SERVICEURL);

Part of the response:

< X-Account-Object-Count: 73
< Accept-Ranges: bytes
< X-Timestamp: 1435806531.03469
< X-Account-Meta-Quota-Bytes: 10737418240
< X-Account-Bytes-Used: 8210758222
< X-Account-Meta-Test: �����Įķ�Ol

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
version 2.4.1

Please provide any additional information below.

Original issue reported on code.google.com by kavita...@gmail.com on 21 Jul 2015 at 8:36

GoogleCodeExporter commented 8 years ago
Its not an issue with Set. On further analysis i figured out its with getting 
header value.  

When i set the header in the log i can see its setting the non-Ascii data 
correctly. Where in when i do a get using 
              Response response =
                  expect().
                      statusCode(204).
                  given().
                      headers("X-Auth-Token", authToken).
                      head(fixture.SERVICERESTENDPOINT);
              String metatips = response.getHeader("X-Account-Meta-Tips123").toString();

              assertEquals("μεταδεδομένα", metatips);

Its displaying garbled value.

Is there any limitation to response.getHeader(" ").toString(); ??
When i tried setting Ascii characters its working fine. 

Original comment by kavita...@gmail.com on 22 Jul 2015 at 12:23