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

Commit c480462

Browse files
gyx1000caitp
authored andcommitted
fix($httpBackend): compare timeoutId with undefined in completeRequest
httpBackend with ngMock browser.defer can 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.
1 parent 9cc6835 commit c480462

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ng/httpBackend.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ 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+
timeoutId !== undefined && $browserDefer.cancel(timeoutId);
130130
jsonpDone = xhr = null;
131131

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

0 commit comments

Comments
 (0)