blob: 5ff5c510f9097555842f4f7d835460e2fd6ee2b7 [file] [log] [blame]
{"version":3,"sources":["packages/common/common-http-testing.umd.js"],"names":["global","factory","exports","module","require","define","amd","self","ng","common","http","testing","core","rxjs","this","HttpTestingController","__decorate","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","TestRequest","request","observer","_cancelled","prototype","get","enumerable","configurable","flush","body","opts","cancelled","Error","url","urlWithParams","headers","HttpHeaders","_maybeConvertBody","responseType","_toArrayBufferBody","ArrayBuffer","_toBlob","Blob","_toJsonBody","_toTextBody","JSON","stringify","statusText","status","undefined","next","HttpResponse","complete","error","HttpErrorResponse","event","format","Array","isArray","HttpClientTestingBackend","open","handle","req","_this","Observable","testReq","push","type","HttpEventType","Sent","_match","match","filter","method","toUpperCase","results","forEach","result","index","indexOf","splice","expectOne","description","descriptionFromMatcher","matches","expectNone","verify","ignoreCancelled","requests","map","split","join","matcher","name","Injectable","HttpClientTestingModule","NgModule","imports","HttpClientModule","providers","provide","HttpBackend","useExisting","ɵangular_packages_common_http_testing_testing_a","value"],"mappings":";;;;;CAMC,SAAUA,EAAQC,GACI,iBAAZC,SAA0C,oBAAXC,OAAyBF,EAAQC,QAASE,QAAQ,wBAAyBA,QAAQ,iBAAkBA,QAAQ,SACjI,mBAAXC,QAAyBA,OAAOC,IAAMD,OAAO,+BAAgC,CAAC,UAAW,uBAAwB,gBAAiB,QAASJ,GACxHA,IAAzBD,EAASA,GAAUO,MAAsBC,GAAKR,EAAOQ,IAAM,GAAIR,EAAOQ,GAAGC,OAAST,EAAOQ,GAAGC,QAAU,GAAIT,EAAOQ,GAAGC,OAAOC,KAAOV,EAAOQ,GAAGC,OAAOC,MAAQ,GAAIV,EAAOQ,GAAGC,OAAOC,KAAKC,QAAU,IAAKX,EAAOQ,GAAGC,OAAOC,KAAMV,EAAOQ,GAAGI,KAAMZ,EAAOa,MAHvP,CAIEC,KAAM,SAAUZ,EAASQ,EAAME,E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D,QACrC,IAATA,IAAmBA,EAAO,IAC9B,IAAI8B,EAAO1D,KAAK0D,KAMhB,GAHI9B,EAAKyD,kBACL3B,EAAOA,EAAKY,OAAO,SAAUP,GAAW,OAAQA,EAAQlC,aAExD6B,EAAKhD,OAAS,EAAG,CAEjB,IAAI4E,EAAW5B,EAAK6B,IAAI,SAAUxB,GAC9B,IAAIhC,EAAMgC,EAAQ5C,QAAQa,cAAcwD,MAAM,KAAK,GAEnD,OADazB,EAAQ5C,QAAQoD,OACb,IAAMxC,IAErB0D,KAAK,MACV,MAAM,IAAI3D,MAAM,oCAAsC4B,EAAKhD,OAAS,KAAO4E,KAGnF7B,EAAyBnC,UAAU2D,uBAAyB,SAAUS,GAClE,MAAuB,iBAAZA,EACA,cAAgBA,EAEC,iBAAZA,EAGL,kBAFMA,EAAQnB,QAAU,SAEI,WADzBmB,EAAQ3D,KAAO,SAIlB,sBAAwB2D,EAAQC,MAGpBzF,EAAW,CAClCJ,EAAK8F,cACNnC,GAnHsC,GAqIzCoC,EAAyC,WAezC,OAZ0B3F,EAAW,CACjCJ,EAAKgG,SAAS,CACVC,QAAS,CACLnG,EAAKoG,kBAETC,UAAW,CACPxC,EACA,CAAEyC,QAAStG,EAAKuG,YAAaC,YAAa3C,GAC1C,CAAEyC,QAASjG,EAAuBmG,YAAa3C,OAV3D,SAASoC,OAD+B;;;;;;;;;;;;;;;;;;;;;;AAsC5CzG,EAAQiH,gDAAkD5C,EAC1DrE,EAAQa,sBAAwBA,EAChCb,EAAQyG,wBAA0BA,EAClCzG,EAAQ8B,YAAcA,EAEtBN,OAAOK,eAAe7B,EAAS,aAAc,CAAEkH,OAAO","sourcesContent":["/**\n * @license Angular v8.1.1\n * (c) 2010-2019 Google LLC. https://angular.io/\n * License: MIT\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('rxjs')) :\n typeof define === 'function' && define.amd ? define('@angular/common/http/testing', ['exports', '@angular/common/http', '@angular/core', 'rxjs'], factory) :\n (global = global || self, factory((global.ng = global.ng || {}, global.ng.common = global.ng.common || {}, global.ng.common.http = global.ng.common.http || {}, global.ng.common.http.testing = {}), global.ng.common.http, global.ng.core, global.rxjs));\n}(this, function (exports, http, core, rxjs) { 'use strict';\n\n /**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /**\n * Controller to be injected into tests, that allows for mocking and flushing\n * of requests.\n *\n * @publicApi\n */\n var HttpTestingController = /** @class */ (function () {\n function HttpTestingController() {\n }\n return HttpTestingController;\n }());\n\n /*! *****************************************************************************\r\n Copyright (c) Microsoft Corporation. All rights reserved.\r\n Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\n this file except in compliance with the License. You may obtain a copy of the\r\n License at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\n WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\n MERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\n See the Apache Version 2.0 License for specific language governing permissions\r\n and limitations under the License.\r\n ***************************************************************************** */\r\n\r\n function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n }\n\n /**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /**\n * A mock requests that was received and is ready to be answered.\n *\n * This interface allows access to the underlying `HttpRequest`, and allows\n * responding with `HttpEvent`s or `HttpErrorResponse`s.\n *\n * @publicApi\n */\n var TestRequest = /** @class */ (function () {\n function TestRequest(request, observer) {\n this.request = request;\n this.observer = observer;\n /**\n * @internal set by `HttpClientTestingBackend`\n */\n this._cancelled = false;\n }\n Object.defineProperty(TestRequest.prototype, \"cancelled\", {\n /**\n * Whether the request was cancelled after it was sent.\n */\n get: function () { return this._cancelled; },\n enumerable: true,\n configurable: true\n });\n /**\n * Resolve the request by returning a body plus additional HTTP information (such as response\n * headers) if provided.\n * If the request specifies an expected body type, the body is converted into the requested type.\n * Otherwise, the body is converted to `JSON` by default.\n *\n * Both successful and unsuccessful responses can be delivered via `flush()`.\n */\n TestRequest.prototype.flush = function (body, opts) {\n if (opts === void 0) { opts = {}; }\n if (this.cancelled) {\n throw new Error(\"Cannot flush a cancelled request.\");\n }\n var url = this.request.urlWithParams;\n var headers = (opts.headers instanceof http.HttpHeaders) ? opts.headers : new http.HttpHeaders(opts.headers);\n body = _maybeConvertBody(this.request.responseType, body);\n var statusText = opts.statusText;\n var status = opts.status !== undefined ? opts.status : 200;\n if (opts.status === undefined) {\n if (body === null) {\n status = 204;\n statusText = statusText || 'No Content';\n }\n else {\n statusText = statusText || 'OK';\n }\n }\n if (statusText === undefined) {\n throw new Error('statusText is required when setting a custom status.');\n }\n if (status >= 200 && status < 300) {\n this.observer.next(new http.HttpResponse({ body: body, headers: headers, status: status, statusText: statusText, url: url }));\n this.observer.complete();\n }\n else {\n this.observer.error(new http.HttpErrorResponse({ error: body, headers: headers, status: status, statusText: statusText, url: url }));\n }\n };\n /**\n * Resolve the request by returning an `ErrorEvent` (e.g. simulating a network failure).\n */\n TestRequest.prototype.error = function (error, opts) {\n if (opts === void 0) { opts = {}; }\n if (this.cancelled) {\n throw new Error(\"Cannot return an error for a cancelled request.\");\n }\n if (opts.status && opts.status >= 200 && opts.status < 300) {\n throw new Error(\"error() called with a successful status.\");\n }\n var headers = (opts.headers instanceof http.HttpHeaders) ? opts.headers : new http.HttpHeaders(opts.headers);\n this.observer.error(new http.HttpErrorResponse({\n error: error,\n headers: headers,\n status: opts.status || 0,\n statusText: opts.statusText || '',\n url: this.request.urlWithParams,\n }));\n };\n /**\n * Deliver an arbitrary `HttpEvent` (such as a progress event) on the response stream for this\n * request.\n */\n TestRequest.prototype.event = function (event) {\n if (this.cancelled) {\n throw new Error(\"Cannot send events to a cancelled request.\");\n }\n this.observer.next(event);\n };\n return TestRequest;\n }());\n /**\n * Helper function to convert a response body to an ArrayBuffer.\n */\n function _toArrayBufferBody(body) {\n if (typeof ArrayBuffer === 'undefined') {\n throw new Error('ArrayBuffer responses are not supported on this platform.');\n }\n if (body instanceof ArrayBuffer) {\n return body;\n }\n throw new Error('Automatic conversion to ArrayBuffer is not supported for response type.');\n }\n /**\n * Helper function to convert a response body to a Blob.\n */\n function _toBlob(body) {\n if (typeof Blob === 'undefined') {\n throw new Error('Blob responses are not supported on this platform.');\n }\n if (body instanceof Blob) {\n return body;\n }\n if (ArrayBuffer && body instanceof ArrayBuffer) {\n return new Blob([body]);\n }\n throw new Error('Automatic conversion to Blob is not supported for response type.');\n }\n /**\n * Helper function to convert a response body to JSON data.\n */\n function _toJsonBody(body, format) {\n if (format === void 0) { format = 'JSON'; }\n if (typeof ArrayBuffer !== 'undefined' && body instanceof ArrayBuffer) {\n throw new Error(\"Automatic conversion to \" + format + \" is not supported for ArrayBuffers.\");\n }\n if (typeof Blob !== 'undefined' && body instanceof Blob) {\n throw new Error(\"Automatic conversion to \" + format + \" is not supported for Blobs.\");\n }\n if (typeof body === 'string' || typeof body === 'number' || typeof body === 'object' ||\n Array.isArray(body)) {\n return body;\n }\n throw new Error(\"Automatic conversion to \" + format + \" is not supported for response type.\");\n }\n /**\n * Helper function to convert a response body to a string.\n */\n function _toTextBody(body) {\n if (typeof body === 'string') {\n return body;\n }\n if (typeof ArrayBuffer !== 'undefined' && body instanceof ArrayBuffer) {\n throw new Error('Automatic conversion to text is not supported for ArrayBuffers.');\n }\n if (typeof Blob !== 'undefined' && body instanceof Blob) {\n throw new Error('Automatic conversion to text is not supported for Blobs.');\n }\n return JSON.stringify(_toJsonBody(body, 'text'));\n }\n /**\n * Convert a response body to the requested type.\n */\n function _maybeConvertBody(responseType, body) {\n if (body === null) {\n return null;\n }\n switch (responseType) {\n case 'arraybuffer':\n return _toArrayBufferBody(body);\n case 'blob':\n return _toBlob(body);\n case 'json':\n return _toJsonBody(body);\n case 'text':\n return _toTextBody(body);\n default:\n throw new Error(\"Unsupported responseType: \" + responseType);\n }\n }\n\n /**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /**\n * A testing backend for `HttpClient` which both acts as an `HttpBackend`\n * and as the `HttpTestingController`.\n *\n * `HttpClientTestingBackend` works by keeping a list of all open requests.\n * As requests come in, they're added to the list. Users can assert that specific\n * requests were made and then flush them. In the end, a verify() method asserts\n * that no unexpected requests were made.\n *\n *\n */\n var HttpClientTestingBackend = /** @class */ (function () {\n function HttpClientTestingBackend() {\n /**\n * List of pending requests which have not yet been expected.\n */\n this.open = [];\n }\n /**\n * Handle an incoming request by queueing it in the list of open requests.\n */\n HttpClientTestingBackend.prototype.handle = function (req) {\n var _this = this;\n return new rxjs.Observable(function (observer) {\n var testReq = new TestRequest(req, observer);\n _this.open.push(testReq);\n observer.next({ type: http.HttpEventType.Sent });\n return function () { testReq._cancelled = true; };\n });\n };\n /**\n * Helper function to search for requests in the list of open requests.\n */\n HttpClientTestingBackend.prototype._match = function (match) {\n if (typeof match === 'string') {\n return this.open.filter(function (testReq) { return testReq.request.urlWithParams === match; });\n }\n else if (typeof match === 'function') {\n return this.open.filter(function (testReq) { return match(testReq.request); });\n }\n else {\n return this.open.filter(function (testReq) { return (!match.method || testReq.request.method === match.method.toUpperCase()) &&\n (!match.url || testReq.request.urlWithParams === match.url); });\n }\n };\n /**\n * Search for requests in the list of open requests, and return all that match\n * without asserting anything about the number of matches.\n */\n HttpClientTestingBackend.prototype.match = function (match) {\n var _this = this;\n var results = this._match(match);\n results.forEach(function (result) {\n var index = _this.open.indexOf(result);\n if (index !== -1) {\n _this.open.splice(index, 1);\n }\n });\n return results;\n };\n /**\n * Expect that a single outstanding request matches the given matcher, and return\n * it.\n *\n * Requests returned through this API will no longer be in the list of open requests,\n * and thus will not match twice.\n */\n HttpClientTestingBackend.prototype.expectOne = function (match, description) {\n description = description || this.descriptionFromMatcher(match);\n var matches = this.match(match);\n if (matches.length > 1) {\n throw new Error(\"Expected one matching request for criteria \\\"\" + description + \"\\\", found \" + matches.length + \" requests.\");\n }\n if (matches.length === 0) {\n throw new Error(\"Expected one matching request for criteria \\\"\" + description + \"\\\", found none.\");\n }\n return matches[0];\n };\n /**\n * Expect that no outstanding requests match the given matcher, and throw an error\n * if any do.\n */\n HttpClientTestingBackend.prototype.expectNone = function (match, description) {\n description = description || this.descriptionFromMatcher(match);\n var matches = this.match(match);\n if (matches.length > 0) {\n throw new Error(\"Expected zero matching requests for criteria \\\"\" + description + \"\\\", found \" + matches.length + \".\");\n }\n };\n /**\n * Validate that there are no outstanding requests.\n */\n HttpClientTestingBackend.prototype.verify = function (opts) {\n if (opts === void 0) { opts = {}; }\n var open = this.open;\n // It's possible that some requests may be cancelled, and this is expected.\n // The user can ask to ignore open requests which have been cancelled.\n if (opts.ignoreCancelled) {\n open = open.filter(function (testReq) { return !testReq.cancelled; });\n }\n if (open.length > 0) {\n // Show the methods and URLs of open requests in the error, for convenience.\n var requests = open.map(function (testReq) {\n var url = testReq.request.urlWithParams.split('?')[0];\n var method = testReq.request.method;\n return method + \" \" + url;\n })\n .join(', ');\n throw new Error(\"Expected no open requests, found \" + open.length + \": \" + requests);\n }\n };\n HttpClientTestingBackend.prototype.descriptionFromMatcher = function (matcher) {\n if (typeof matcher === 'string') {\n return \"Match URL: \" + matcher;\n }\n else if (typeof matcher === 'object') {\n var method = matcher.method || '(any)';\n var url = matcher.url || '(any)';\n return \"Match method: \" + method + \", URL: \" + url;\n }\n else {\n return \"Match by function: \" + matcher.name;\n }\n };\n HttpClientTestingBackend = __decorate([\n core.Injectable()\n ], HttpClientTestingBackend);\n return HttpClientTestingBackend;\n }());\n\n /**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /**\n * Configures `HttpClientTestingBackend` as the `HttpBackend` used by `HttpClient`.\n *\n * Inject `HttpTestingController` to expect and flush requests in your tests.\n *\n * @publicApi\n */\n var HttpClientTestingModule = /** @class */ (function () {\n function HttpClientTestingModule() {\n }\n HttpClientTestingModule = __decorate([\n core.NgModule({\n imports: [\n http.HttpClientModule,\n ],\n providers: [\n HttpClientTestingBackend,\n { provide: http.HttpBackend, useExisting: HttpClientTestingBackend },\n { provide: HttpTestingController, useExisting: HttpClientTestingBackend },\n ],\n })\n ], HttpClientTestingModule);\n return HttpClientTestingModule;\n }());\n\n /**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n /**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n /**\n * Generated bundle index. Do not edit.\n */\n\n exports.ɵangular_packages_common_http_testing_testing_a = HttpClientTestingBackend;\n exports.HttpTestingController = HttpTestingController;\n exports.HttpClientTestingModule = HttpClientTestingModule;\n exports.TestRequest = TestRequest;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n}));\n//# sourceMappingURL=common-http-testing.umd.js.map\n"]}