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

Commit 719d5c5

Browse files
gyx1000pkozlowski-opensource
authored andcommitted
fix($httpBackend): allow canceling request with falsy timeoutId
httpBackend with ngMock browser.defer could never cancel the first deferredFn because the timeoutId returned by defer for the first fn is a zero value. Compare timeoutId with undefined fix this issue. Closes #10177
1 parent 266da34 commit 719d5c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ng/httpBackend.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
126126

127127
function completeRequest(callback, status, response, headersString, statusText) {
128128
// cancel timeout and subsequent timeout promise resolution
129-
timeoutId && $browserDefer.cancel(timeoutId);
129+
if (timeoutId !== undefined) {
130+
$browserDefer.cancel(timeoutId);
131+
}
130132
jsonpDone = xhr = null;
131133

132134
callback(status, response, headersString, statusText);

0 commit comments

Comments
 (0)