Dave Clark
Dave Clark

Reputation: 31

How can I send duplicate headers to $http in AngularJs?

I need to pass two headers with the same key in my $http request. This is a server requirement that can't be changed.

{ "Authorization": "Basic XXXX", "Authorization": "Basic YYYY" }

You pass headers into $http as an object, so I don't know how to send duplicate keys.

Upvotes: 1

Views: 97

Answers (1)

Dave Clark
Dave Clark

Reputation: 31

I found the answer to my own question. The HTTP Spec requires that these two things are equal:

Header: Value1
Header: Value2

and

Header: Value1, Value2

And the second way is compatible with object literals.

See Are Duplicate HTTP Response Headers acceptable?

Upvotes: 2

Related Questions