It looks like it's a browser: when a remote script is requested (as is the case with JSONP requests) and the response returns 400 HTTP status (or higher), any code that can still get returned in the response body is not evaluated (it really makes sense )
Angular will only know that the response was sent and that it had an error status, but since the callback was not called, there is no payload data to send the callback.
I tested a standalone HTML page:
<script> function foo(data) { alert('foo') } </script> <script src="/endpoint?callback=foo"></script>
And the following express handler:
app.get('/endpoint', (req, res) => { return res.status(400).jsonp({ hello : 'world' }); });
State 400 does not raise a warning, state 200. It also does not work if the handler returns a simple JS (acts like a simple .js file that is loaded using <script src=...> ).
So, for JSONP requests, you must adhere to 200 responses and pass any errors in some other way (for example, set the error property in the response object).
source share