-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Conversation
…e handled You can now override this service if you have specific requirements about the behaviour and formatting of the JSON_CALLBACK that is sent to the server for `$http.jsonp` requests.
browserTrigger(script, "load"); | ||
|
||
expect(callback).toHaveBeenCalledOnce(); | ||
}); | ||
|
||
|
||
it('should clean up the callback and remove the script', function() { | ||
spyOn($jsonpCallbacks, 'wasCalled').and.callThrough(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope
A few minor comments - LGTM otherwise. |
Use the built-in service to handling callbacks to `$http.jsonp` requests. Closes angular#3073
c7cf465
to
c1a335d
Compare
I fixed up IE... the problem was that occasionally, in the test, it was actually triggering the script callback at some point in the future, after the test had completed. When this happened the status of the response was a 404. So I put in a check that the status of the response is a 200 before trying to get hold of the response. |
…e handled You can now override this service if you have specific requirements about the behaviour and formatting of the JSON_CALLBACK that is sent to the server for `$http.jsonp` requests.
Use the built-in service to handling callbacks to `$http.jsonp` requests. Closes angular#3073
@gkalpak thanks for the review. PTAL |
callbacks[callbackId] = noop; | ||
var callbackPath = callbacks.createCallback(url); | ||
var jsonpDone = jsonpReq(url, callbackPath, function(status, text) { | ||
var response = (status === 200) && callbacks.getResponse(callbackPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: I would add a note that status
is set in jsonpReq()
and it can be either -1
, 404
or 200
.
The first time I saw this, I thought: "What if it is in the (200, 300) range?"
LGTM 👍 |
Thanks. I'll comment on the |
…e handled You can now override this service if you have specific requirements about the behaviour and formatting of the JSON_CALLBACK that is sent to the server for `$http.jsonp` requests. Closes #14795
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
feat
What is the current behavior? (You can also link to an open issue here)
hard-coded jsonp callback handling
What is the new behavior (if this is a feature change)?
overridable
$jsonpCallbacks
service that offers a place where customisation can be appliedDoes this PR introduce a breaking change?
No
Please check if the PR fulfills these requirements
Other information:
See the commits