MCPcopy Create free account
hub / github.com/angular/angular / jsonpInterceptorFn

Function jsonpInterceptorFn

packages/common/http/src/jsonp.ts:312–322  ·  view source on GitHub ↗
(
  req: HttpRequest<unknown>,
  next: HttpHandlerFn,
)

Source from the content-addressed store, hash-verified

310 * @deprecated 22.1 JSONP is deprecated as it can cause XSS vulnerabilities. Use standard HTTP requests instead. Intent to remove in future versions of Angular.
311 */
312export function jsonpInterceptorFn(
313 req: HttpRequest<unknown>,
314 next: HttpHandlerFn,
315): Observable<HttpEvent<unknown>> {
316 if (req.method === 'JSONP') {
317 return inject(JsonpClientBackend).handle(req as HttpRequest<never>);
318 }
319
320 // Fall through for normal HTTP requests.
321 return next(req);
322}
323
324/**
325 * Identifies requests with the method JSONP and

Callers 1

interceptMethod · 0.85

Calls 3

injectFunction · 0.90
handleMethod · 0.65
nextFunction · 0.50

Tested by

no test coverage detected