You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
If the response to a $http request contains a header but its value is empty, the value should be an empty string, not "null". Right?
I get foo == null even though X-Foo-Meta is in the response headers.
$http.get("/validate")
.success(function(respBody, status, respHeaders, config) {
$scope.foo = respHeaders('X-Foo-Meta');
// it seems foo should be "", not null, here
...
The bug seems to be in angular.js v1.2.17
function headersGetter(headers) {
...
return headersObj[lowercase(name)] || null;
The text was updated successfully, but these errors were encountered:
The empty string is the only case where this would happen. I'm not sure that it's common for headers to have empty value fields (I'm not actually sure if it's even legal in HTTP, to be honest --- don't feel like studying poorly written technical documents regarding this at the moment!)
However, it should be trivial to make this work, if you want to send a PR for this. I think it would be small and easy to check in
Empty response header values are legal (http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html).
Return an empty string instead of null, which is returned when the header does not exist.
The "Constructor" test is failing, not sure how to fix.
Closesangular#7779
jamshid
added a commit
to jamshid/angular.js
that referenced
this issue
Nov 18, 2014
If the response to a $http request contains a header but its value is empty, the value should be an empty string, not "null". Right?
I get foo == null even though X-Foo-Meta is in the response headers.
The bug seems to be in angular.js v1.2.17
The text was updated successfully, but these errors were encountered: