Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b9c0de3

Browse files
committed
coercing undefined to null
1 parent afef960 commit b9c0de3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/ng/httpBackend.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
109109
}
110110
}
111111

112-
xhr.send(post);
112+
xhr.send(isDefined(post) ? post : null);
113113
}
114114

115115
if (timeout > 0) {

test/ng/httpBackendSpec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ describe('$httpBackend', function() {
5050
expect(xhr.$$data).toBe(null);
5151
});
5252

53+
it('should pass false to send if false body is set', function() {
54+
$backend('GET', '/some-url', false, noop);
55+
xhr = MockXhr.$$lastInstance;
56+
57+
expect(xhr.$$data).toBe(false);
58+
});
59+
5360
it('should call completion function with xhr.statusText if present', function() {
5461
callback.andCallFake(function(status, response, headers, statusText) {
5562
expect(statusText).toBe('OK');

0 commit comments

Comments
 (0)