diff options
| author | Ricardo Bin | 2013-09-03 18:19:38 -0300 | 
|---|---|---|
| committer | Brian Ford | 2013-10-01 14:02:00 -0700 | 
| commit | e9a222418a029d830698444cf95bf13f8ad75805 (patch) | |
| tree | 1c0ab955f4f2d3abf493fb6fd59707a62cf09dda /test/ng/httpBackendSpec.js | |
| parent | 936101041a9a1f1cf9fecf6b5fcfae206cd15424 (diff) | |
| download | angular.js-e9a222418a029d830698444cf95bf13f8ad75805.tar.bz2 | |
fix($httpBackend): set headers with falsy values
This is a breaking change. To migrate to the new behavior,
delete or set headers to `undefined` to avoid having them sent.
To restore the old behavior, override `$httpBackendProvider`
with the old implementation.
Closes #2984
Diffstat (limited to 'test/ng/httpBackendSpec.js')
| -rw-r--r-- | test/ng/httpBackendSpec.js | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/test/ng/httpBackendSpec.js b/test/ng/httpBackendSpec.js index 5d2654a9..faec5737 100644 --- a/test/ng/httpBackendSpec.js +++ b/test/ng/httpBackendSpec.js @@ -101,6 +101,22 @@ describe('$httpBackend', function() {      });    }); +  it('should set requested headers even if they have falsy values', function() { +    $backend('POST', 'URL', null, noop, { +      'X-header1': 0, +      'X-header2': '', +      'X-header3': false, +      'X-header4': undefined +    }); + +    xhr = MockXhr.$$lastInstance; + +    expect(xhr.$$reqHeaders).toEqual({ +      'X-header1': 0, +      'X-header2': '', +      'X-header3': false +    }); +  });    it('should abort request on timeout', function() {      callback.andCallFake(function(status, response) { @@ -388,6 +404,7 @@ describe('$httpBackend', function() {        expect(callback).toHaveBeenCalled();        expect(callback.mostRecentCall.args[0]).toBe(404);      }); +    });  }); | 
