mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-28 21:05:43 +08:00
fix($http): return empty headers, ignore properties in Object prototype
Fix response headers with an empty value Empty response header values are legal (http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html). The headers getter fn will now only return null if the header property is not an own property. Closes #7779 Closes #10113 Closes #10091
This commit is contained in:
committed by
Caitlin Potter
parent
f7fde935d5
commit
637c020f82
@@ -816,6 +816,17 @@ describe('$http', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should handle empty response header', function() {
|
||||
$httpBackend.expect('GET', '/url', undefined)
|
||||
.respond(200, '', { 'Custom-Empty-Response-Header': '', 'Constructor': '' });
|
||||
$http.get('/url').success(callback);
|
||||
$httpBackend.flush();
|
||||
expect(callback).toHaveBeenCalledOnce();
|
||||
expect(callback.mostRecentCall.args[2]('custom-empty-response-Header')).toBe('');
|
||||
expect(callback.mostRecentCall.args[2]('ToString')).toBe(null);
|
||||
expect(callback.mostRecentCall.args[2]('Constructor')).toBe('');
|
||||
});
|
||||
|
||||
it('should have delete()', function() {
|
||||
$httpBackend.expect('DELETE', '/url').respond('');
|
||||
$http['delete']('/url');
|
||||
|
||||
Reference in New Issue
Block a user