This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 231
/
http-client-backend.service.js.map
1 lines (1 loc) · 5.41 KB
/
http-client-backend.service.js.map
1
{"version":3,"file":"http-client-backend.service.js","sourceRoot":"","sources":["http-client-backend.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAGL,WAAW,EACX,UAAU,EAEV,YAAY,EACZ,cAAc,EACd,UAAU,EACX,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EAElB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;IAA8C,4CAAc;IAE1D,kCACE,cAAiC,EACU,MAAiC,EACpE,UAAsB;QAHhC,YAKE,kBAAM,cAAc,EAAE,MAAM,CAAC,SAC9B;QAHS,gBAAU,GAAV,UAAU,CAAY;;IAGhC,CAAC;IAED,yCAAM,GAAN,UAAO,GAAqB;QAC1B,IAAI;YACF,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;SAEhC;QAAC,OAAO,KAAK,EAAE;YACd,IAAM,GAAG,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC;YACnC,IAAM,YAAU,GAAG,IAAI,CAAC,0BAA0B,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,qBAAqB,EAAE,KAAG,GAAK,CAAC,CAAC;YACpG,OAAO,IAAI,CAAC,eAAe,CAAC,cAAM,OAAA,YAAU,EAAV,CAAU,CAAC,CAAC;SA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,qBAAqB,CAAC,CAAA,EAAE,WAAA,QAAQ,EAAE,CAAA;yCAD1B,iBAAiB;YACkB,yBAAyB;YACxD,UAAU;OALrB,wBAAwB,CAwDpC;IAAD,+BAAC;CAAA,AAxDD,CAA8C,cAAc,GAwD3D;SAxDY,wBAAwB","sourcesContent":["import { Inject, Injectable, Optional } from '@angular/core';\nimport {\n HttpBackend,\n HttpEvent,\n HttpHeaders,\n HttpParams,\n HttpRequest,\n HttpResponse, HttpResponseBase,\n HttpXhrBackend,\n XhrFactory\n} from '@angular/common/http';\n\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { STATUS } from './http-status-codes';\n\nimport {\n InMemoryBackendConfig,\n InMemoryBackendConfigArgs,\n InMemoryDbService,\n ResponseOptions\n} from './interfaces';\n\nimport { BackendService } from './backend.service';\n\n/**\n * For Angular `HttpClient` simulate the behavior of a RESTy web api\n * backed by the simple in-memory data store provided by the injected `InMemoryDbService`.\n * Conforms mostly to behavior described here:\n * http://www.restapitutorial.com/lessons/httpmethods.html\n *\n * ### Usage\n *\n * Create an in-memory data store class that implements `InMemoryDbService`.\n * Call `config` static method with this service class and optional configuration object:\n * ```\n * // other imports\n * import { HttpClientModule } from '@angular/common/http';\n * import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';\n *\n * import { InMemHeroService, inMemConfig } from '../api/in-memory-hero.service';\n * @NgModule({\n * imports: [\n * HttpModule,\n * HttpClientInMemoryWebApiModule.forRoot(InMemHeroService, inMemConfig),\n * ...\n * ],\n * ...\n * })\n * export class AppModule { ... }\n * ```\n */\n@Injectable()\nexport class HttpClientBackendService extends BackendService implements HttpBackend {\n\n constructor(\n inMemDbService: InMemoryDbService,\n @Inject(InMemoryBackendConfig) @Optional() config: InMemoryBackendConfigArgs,\n private xhrFactory: XhrFactory\n ) {\n super(inMemDbService, config);\n }\n\n handle(req: HttpRequest<any>): Observable<HttpEvent<any>> {\n try {\n return this.handleRequest(req);\n\n } catch (error) {\n const err = error.message || error;\n const resOptions = this.createErrorResponseOptions(req.url, STATUS.INTERNAL_SERVER_ERROR, `${err}`);\n return this.createResponse$(() => resOptions);\n }\n }\n\n //// protected overrides /////\n\n protected getJsonBody(req: HttpRequest<any>): any {\n return req.body;\n }\n\n protected getRequestMethod(req: HttpRequest<any>): string {\n return (req.method || 'get').toLowerCase();\n }\n\n protected createHeaders(headers: { [index: string]: string; }): HttpHeaders {\n return new HttpHeaders(headers);\n }\n\n protected createQueryMap(search: string): Map<string, string[]> {\n const map = new Map<string, string[]>();\n if (search) {\n const params = new HttpParams({fromString: search});\n params.keys().forEach(p => map.set(p, params.getAll(p)));\n }\n return map;\n }\n\n protected createResponse$fromResponseOptions$(resOptions$: Observable<ResponseOptions>): Observable<HttpResponse<any>> {\n return resOptions$.pipe(map((opts: HttpResponseBase) => new HttpResponse<any>(opts)));\n }\n\n protected createPassThruBackend() {\n try {\n return new HttpXhrBackend(this.xhrFactory);\n } catch (ex) {\n ex.message = 'Cannot create passThru404 backend; ' + (ex.message || '');\n throw ex;\n }\n }\n}\n"]}