rijojoy / chrome-rest-client

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

I'm not sure your handling of multi-valued Headers is correct #295

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Set Headers box like
Accept:application/json
X-User-Id:19640718
X-User-Role:Agent,Underwriter
X-Bob-Header:Bob,Robert,Kuhar
X-Bob-Header:Dread Pirate
X-Bob-Header:Manuel

2.  Send request to some server dumping the headers

What is the expected output?
Expected request to contain 3 separate instances of the X-Bob-Header;
  X-Bob-Header:Bob,Robert,Kuhar
  X-Bob-Header:Dread Pirate
  X-Bob-Header:Manuel

What do you see instead?
Actual request contains only a single X-Bob-Header;
  X-Bob-Header: Bob,Robert,Kuhar, Dread Pirate, Manuel

On what operating system, browser and browser version?
Chrome on OS X

When I curl the same request I get the behavior I expected on the server.  I'm 
not sure it is correct to pre-process the header values before you send them 
off.

$curl -v -i -X GET http://localhost:8080/headers -H 'Accept:application/json' 
-H 'X-User-Id:19640718' -H 'X-User-Role:Agent,Underwriter' -H 
'X-Bob-Header:Bob,Robert,Kuhar' -H 'X-Bob-Header:Dread Pirate' -H 
'X-Bob-Header:Manuel'
* Adding handle: conn: 0x7fa402804000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fa402804000) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 8080 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
> GET /headers HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:8080
> Accept:application/json
> X-User-Id:19640718
> X-User-Role:Agent,Underwriter
> X-Bob-Header:Bob,Robert,Kuhar
> X-Bob-Header:Dread Pirate
> X-Bob-Header:Manuel
> 
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Type: application/json;charset=ISO-8859-1
Content-Type: application/json;charset=ISO-8859-1
< Content-Length: 646
Content-Length: 646
* Server Jetty(8.1.2.v20120308) is not blacklisted
< Server: Jetty(8.1.2.v20120308)
Server: Jetty(8.1.2.v20120308)

< 
{
  "headers" : [ {
    "name" : "Accept",
    "value" : "application/json",
    "values" : [ "application/json" ]
  }, {
    "name" : "X-User-Role",
    "value" : "Agent,Underwriter",
    "values" : [ "Agent,Underwriter" ]
  }, {
    "name" : "User-Agent",
    "value" : "curl/7.30.0",
    "values" : [ "curl/7.30.0" ]
  }, {
    "name" : "X-User-Id",
    "value" : "19640718",
    "values" : [ "19640718" ]
  }, {
    "name" : "X-Bob-Header",
    "value" : "Bob,Robert,Kuhar",
    "values" : [ "Bob,Robert,Kuhar", "Dread Pirate", "Manuel" ]
  }, {
    "name" : "Host",
    "value" : "localhost:8080",
    "values" : [ "localhost:8080" ]
  } ]
* Connection #0 to host localhost left intact
}

Original issue reported on code.google.com by robert.k...@climate.com on 2 Dec 2014 at 6:04

GoogleCodeExporter commented 9 years ago
There is a github project at https://github.com/robertkuhar/gradle-quickstart 
which implements the server side of this as a java servlet.  Who knows, maybe 
the servlet API is wrong.

Original comment by robert.k...@climate.com on 2 Dec 2014 at 6:13