Allow requests to have multiple headers with the same name #101

Merged
merged 1 commit into from Nov 19, 2012

Conversation

Projects
None yet
2 participants
@kanaka
Contributor

kanaka commented Nov 19, 2012

Legitimate HTTP requests can have the same header name repeated in the request but currently, clj-http does not allow this in the request (only in the response from what I can tell). For example, when interacting with Riak, you often have occasion to set index tags using headers and want to have multiple values for the same header name.

To make a request with multiple same named headers, use a collection
for the value.

(http/get url {:debug true :headers {"x-myheader" ["value1" "value2"]}})

...
HttpRequest:
{...
:allHeaders
[...
#,
#],
...}

Allow requests to have multiple headers with the same name.
To make a request with multiple same named headers, use a collection
for the value.

(http/get url {:debug true :headers {"x-myheader" ["value1" "value2"]}})

...
HttpRequest:
{...
 :allHeaders
 [...
  #<BasicHeader x-myheader: value1>,
  #<BasicHeader x-myheader: value2>],
 ...}
@dakrone

This comment has been minimized.

Show comment
Hide comment
@dakrone

dakrone Nov 19, 2012

Owner

Good call, I'll merge this and add some tests, thanks.

Owner

dakrone commented Nov 19, 2012

Good call, I'll merge this and add some tests, thanks.

@dakrone dakrone merged commit bc65f1c into dakrone:master Nov 19, 2012

1 check passed

default The Travis build passed
Details
@dakrone

This comment has been minimized.

Show comment
Hide comment
@dakrone

dakrone Nov 19, 2012

Owner

Merged, thanks!

Owner

dakrone commented Nov 19, 2012

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment