5 lines
116 KiB
JSON
5 lines
116 KiB
JSON
{
|
|
"id": "api/common/http/testing/TestRequest",
|
|
"title": "TestRequest",
|
|
"contents": "\n\n<article>\n <div class=\"breadcrumb-container\">\n <div class=\"breadcrumb\">\n <script type=\"application/ld+json\">\n {\n \"@context\": \"http://schema.org\",\n \"@type\": \"BreadcrumbList\",\n \"itemListElement\": [\n { \"@type\": \"ListItem\", \"position\": 1, \"item\": { \"@id\": \"https://angular.io//api\", \"name\": \"API\" } },\n { \"@type\": \"ListItem\", \"position\": 2, \"item\": { \"@id\": \"https://angular.io/api/common\", \"name\": \"@angular/common\" } },\n { \"@type\": \"ListItem\", \"position\": 3, \"item\": { \"@id\": \"https://angular.io/api/common/http/testing\", \"name\": \"@angular/common/http/testing\" } },\n { \"@type\": \"ListItem\", \"position\": 4, \"item\": { \"@id\": \"https://angular.io/api/common/http/testing/TestRequest\", \"name\": \"TestRequest\" } }\n ]\n }\n </script>\n <a href=\"/api\">API</a> > <a href=\"api/common\">@angular/common</a> > <a href=\"api/common/http/testing\">@angular/common/http/testing</a>\n </div>\n <div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/packages/common/http/testing/src/request.ts?message=docs(common)%3A%20describe%20your%20change...#L11-L114\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n <a href=\"https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/http/testing/src/request.ts#L11-L114\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n \n <header class=\"api-header\">\n <h1 id=\"testrequest\">TestRequest<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http/testing/TestRequest#testrequest\"><i class=\"material-icons\">link</i></a></h1>\n \n <label class=\"api-type-label class\">class</label>\n \n \n \n </header>\n \n <aio-toc class=\"embedded\"></aio-toc>\n\n <div class=\"api-body\">\n \n <section class=\"short-description\">\n <p>A mock requests that was received and is ready to be answered.</p>\n\n <p><a href=\"api/common/http/testing/TestRequest#description\">See more...</a></p>\n </section>\n \n \n \n <section class=\"class-overview\">\n<code-example language=\"ts\" hidecopy=\"true\">\nclass <a href=\"api/common/http/testing/TestRequest\" class=\"code-anchor\">TestRequest</a> {\n <a class=\"code-anchor\" href=\"api/common/http/testing/TestRequest#constructor()\"><span class=\"member-name\">constructor</span>(request: HttpRequest<any>, observer: Observer<HttpEvent<any>>)</a>\n <a class=\"code-anchor\" href=\"api/common/http/testing/TestRequest#cancelled\"><span class=\"member-name\">cancelled</span>: boolean</a>\n <a class=\"code-anchor\" href=\"api/common/http/testing/TestRequest#request\"><span class=\"member-name\">request</span>: HttpRequest<any></a>\n <a class=\"code-anchor\" href=\"api/common/http/testing/TestRequest#flush\"><span class=\"member-name\">flush</span>(body: string | number | boolean | Object | ArrayBuffer | Blob | (string | number | boolean | Object)[], opts: { headers?: HttpHeaders | { [name: string]: string | string[]; }; status?: number; statusText?: string; } = {}): void</a>\n <a class=\"code-anchor\" href=\"api/common/http/testing/TestRequest#error\"><span class=\"member-name\">error</span>(error: ErrorEvent, opts: { headers?: HttpHeaders | { [name: string]: string | string[]; }; status?: number; statusText?: string; } = {}): void</a>\n <a class=\"code-anchor\" href=\"api/common/http/testing/TestRequest#event\"><span class=\"member-name\">event</span>(event: HttpEvent<any>): void</a>\n}\n</code-example>\n\n \n \n\n</section>\n\n\n \n\n \n \n<section class=\"description\">\n <h2 id=\"description\">Description<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http/testing/TestRequest#description\"><i class=\"material-icons\">link</i></a></h2>\n <p>This interface allows access to the underlying <code><a href=\"api/common/http/HttpRequest\" class=\"code-anchor\">HttpRequest</a></code>, and allows\nresponding with <code><a href=\"api/common/http/HttpEvent\" class=\"code-anchor\">HttpEvent</a></code>s or <code><a href=\"api/common/http/HttpErrorResponse\" class=\"code-anchor\">HttpErrorResponse</a></code>s.</p>\n\n \n</section>\n\n \n\n\n\n\n\n\n<h2 id=\"constructor\">Constructor<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http/testing/TestRequest#constructor\"><i class=\"material-icons\">link</i></a></h2>\n<a id=\"constructor()\"></a>\n<table class=\"is-full-width method-table constructor\">\n \n <tbody>\n \n \n <tr>\n <td>\n <div class=\"overload-info\">\n \n\n <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box api-heading\"><span class=\"member-name\">constructor</span>(request: <a href=\"api/common/http/HttpRequest\" class=\"code-anchor\">HttpRequest</a><any>, observer: Observer<<a href=\"api/common/http/HttpEvent\" class=\"code-anchor\">HttpEvent</a><any>>)</code-example>\n\n \n\n <h6 class=\"no-anchor\" id=\"parameters\">Parameters</h6>\n <table class=\"is-full-width list-table parameters-table constructor-overload-parameters\">\n <tbody>\n \n <tr class=\"constructor-overload-parameter\">\n <td class=\"param-name\">\n <a id=\"\"></a>\n <code>request</code>\n </td>\n <td class=\"param-type\"><code><a href=\"api/common/http/HttpRequest\" class=\"code-anchor\">HttpRequest</a><any></any></code></td>\n <td class=\"param-description\">\n \n \n </td>\n </tr>\n <tr class=\"constructor-overload-parameter\">\n <td class=\"param-name\">\n <a id=\"\"></a>\n <code>observer</code>\n </td>\n <td class=\"param-type\"><code>Observer<httpevent<any>></httpevent<any></code></td>\n <td class=\"param-description\">\n \n \n </td>\n </tr>\n </tbody>\n</table>\n\n \n\n\n \n\n \n</div>\n </td>\n </tr>\n \n\n \n\n \n </tbody>\n</table>\n\n\n\n\n<section class=\"instance-properties\">\n <h2 id=\"properties\">Properties<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http/testing/TestRequest#properties\"><i class=\"material-icons\">link</i></a></h2>\n <table class=\"is-full-width list-table property-table\">\n <thead>\n <tr>\n <th>Property</th>\n <th>Description</th>\n </tr>\n </thead>\n <tbody>\n \n <tr class=\"instance-property\">\n <td>\n <a id=\"cancelled\"></a>\n <code class=\"\"><span class=\"member-name\">cancelled</span>: boolean</code>\n </td>\n <td><span class=\"read-only-property\">Read-Only</span>\n \n <p>Whether the request was cancelled after it was sent.</p>\n\n \n </td>\n </tr>\n \n <tr class=\"instance-property\">\n <td>\n <a id=\"request\"></a>\n <code class=\"\"><span class=\"member-name\">request</span>: <a href=\"api/common/http/HttpRequest\" class=\"code-anchor\">HttpRequest</a><any></code>\n </td>\n <td>\n <span class=\"from-constructor\">Declared in Constructor</span>\n \n \n </td>\n </tr>\n \n </tbody>\n </table>\n</section>\n\n\n\n<section class=\"instance-methods\">\n <h2 id=\"methods\">Methods<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http/testing/TestRequest#methods\"><i class=\"material-icons\">link</i></a></h2>\n \n <a id=\"flush\"></a>\n<table class=\"is-full-width method-table instance-method\">\n <thead><tr><th>\n <div class=\"with-github-links\">\n <h3 id=\"flush\">\n flush()\n \n <a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http/testing/TestRequest#flush\"><i class=\"material-icons\">link</i></a></h3>\n <div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/packages/common/http/testing/src/request.ts?message=docs(common)%3A%20describe%20your%20change...#L34-L77\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n <a href=\"https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/http/testing/src/request.ts#L34-L77\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n </th></tr></thead>\n <tbody>\n <tr>\n <td class=\"short-description\">\n <p>Resolve the request by returning a body plus additional HTTP information (such as response\nheaders) if provided.\nIf the request specifies an expected body type, the body is converted into the requested type.\nOtherwise, the body is converted to <code>JSON</code> by default.</p>\n\n </td>\n </tr>\n \n <tr>\n <td>\n <div class=\"overload-info\">\n \n\n <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box api-heading\"><span class=\"member-name\"><a href=\"api/core/testing/flush\" class=\"code-anchor\">flush</a></span>(body: string | <a href=\"api/common/DecimalPipe\" class=\"code-anchor\">number</a> | boolean | Object | ArrayBuffer | Blob | (string | <a href=\"api/common/DecimalPipe\" class=\"code-anchor\">number</a> | boolean | Object)[], opts: { headers?: <a href=\"api/common/http/HttpHeaders\" class=\"code-anchor\">HttpHeaders</a> | { [name: string]: string | string[]; }; status?: number; statusText?: string; } = {}): void</code-example>\n\n \n\n <h6 class=\"no-anchor\" id=\"parameters-1\">Parameters</h6>\n <table class=\"is-full-width list-table parameters-table instance-method-overload-parameters\">\n <tbody>\n \n <tr class=\"instance-method-overload-parameter\">\n <td class=\"param-name\">\n <a id=\"\"></a>\n <code>body</code>\n </td>\n <td class=\"param-type\"><code>string | <a href=\"api/common/DecimalPipe\" class=\"code-anchor\">number</a> | boolean | Object | ArrayBuffer | Blob | (string | <a href=\"api/common/DecimalPipe\" class=\"code-anchor\">number</a> | boolean | Object)[]</code></td>\n <td class=\"param-description\">\n \n \n </td>\n </tr>\n <tr class=\"instance-method-overload-parameter\">\n <td class=\"param-name\">\n <a id=\"\"></a>\n <code>opts</code>\n </td>\n <td class=\"param-type\"><code>object</code></td>\n <td class=\"param-description\">\n <p>Optional. Default is <code>{}</code>.</p>\n \n </td>\n </tr>\n </tbody>\n</table>\n\n \n <h6 class=\"no-anchor\" id=\"returns\">Returns</h6>\n <p><code>void</code></p>\n\n \n\n\n \n\n \n</div>\n </td>\n </tr>\n \n\n <tr>\n <td class=\"description\">\n <p>Both successful and unsuccessful responses can be delivered via <code><a href=\"api/core/testing/flush\" class=\"code-anchor\">flush</a>()</code>.</p>\n\n </td>\n </tr>\n\n \n </tbody>\n</table>\n\n \n <a id=\"error\"></a>\n<table class=\"is-full-width method-table instance-method\">\n <thead><tr><th>\n <div class=\"with-github-links\">\n <h3 id=\"error\">\n error()\n \n <a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http/testing/TestRequest#error\"><i class=\"material-icons\">link</i></a></h3>\n <div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/packages/common/http/testing/src/request.ts?message=docs(common)%3A%20describe%20your%20change...#L78-L102\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n <a href=\"https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/http/testing/src/request.ts#L78-L102\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n </th></tr></thead>\n <tbody>\n <tr>\n <td class=\"short-description\">\n <p>Resolve the request by returning an <code>ErrorEvent</code> (e.g. simulating a network failure).</p>\n\n </td>\n </tr>\n \n <tr>\n <td>\n <div class=\"overload-info\">\n \n\n <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box api-heading\"><span class=\"member-name\">error</span>(error: ErrorEvent, opts: { headers?: <a href=\"api/common/http/HttpHeaders\" class=\"code-anchor\">HttpHeaders</a> | { [name: string]: string | string[]; }; status?: number; statusText?: string; } = {}): void</code-example>\n\n \n\n <h6 class=\"no-anchor\" id=\"parameters-2\">Parameters</h6>\n <table class=\"is-full-width list-table parameters-table instance-method-overload-parameters\">\n <tbody>\n \n <tr class=\"instance-method-overload-parameter\">\n <td class=\"param-name\">\n <a id=\"\"></a>\n <code>error</code>\n </td>\n <td class=\"param-type\"><code>ErrorEvent</code></td>\n <td class=\"param-description\">\n \n \n </td>\n </tr>\n <tr class=\"instance-method-overload-parameter\">\n <td class=\"param-name\">\n <a id=\"\"></a>\n <code>opts</code>\n </td>\n <td class=\"param-type\"><code>object</code></td>\n <td class=\"param-description\">\n <p>Optional. Default is <code>{}</code>.</p>\n \n </td>\n </tr>\n </tbody>\n</table>\n\n \n <h6 class=\"no-anchor\" id=\"returns-1\">Returns</h6>\n <p><code>void</code></p>\n\n \n\n\n \n\n \n</div>\n </td>\n </tr>\n \n\n \n\n \n </tbody>\n</table>\n\n \n <a id=\"event\"></a>\n<table class=\"is-full-width method-table instance-method\">\n <thead><tr><th>\n <div class=\"with-github-links\">\n <h3 id=\"event\">\n event()\n \n <a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http/testing/TestRequest#event\"><i class=\"material-icons\">link</i></a></h3>\n <div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/packages/common/http/testing/src/request.ts?message=docs(common)%3A%20describe%20your%20change...#L103-L113\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n <a href=\"https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/http/testing/src/request.ts#L103-L113\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n </th></tr></thead>\n <tbody>\n <tr>\n <td class=\"short-description\">\n <p>Deliver an arbitrary <code><a href=\"api/common/http/HttpEvent\" class=\"code-anchor\">HttpEvent</a></code> (such as a progress event) on the response stream for this\nrequest.</p>\n\n </td>\n </tr>\n \n <tr>\n <td>\n <div class=\"overload-info\">\n \n\n <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box api-heading\"><span class=\"member-name\">event</span>(event: <a href=\"api/common/http/HttpEvent\" class=\"code-anchor\">HttpEvent</a><any>): void</code-example>\n\n \n\n <h6 class=\"no-anchor\" id=\"parameters-3\">Parameters</h6>\n <table class=\"is-full-width list-table parameters-table instance-method-overload-parameters\">\n <tbody>\n \n <tr class=\"instance-method-overload-parameter\">\n <td class=\"param-name\">\n <a id=\"\"></a>\n <code>event</code>\n </td>\n <td class=\"param-type\"><code><a href=\"api/common/http/HttpEvent\" class=\"code-anchor\">HttpEvent</a><any></any></code></td>\n <td class=\"param-description\">\n \n \n </td>\n </tr>\n </tbody>\n</table>\n\n \n <h6 class=\"no-anchor\" id=\"returns-2\">Returns</h6>\n <p><code>void</code></p>\n\n \n\n\n \n\n \n</div>\n </td>\n </tr>\n \n\n \n\n \n </tbody>\n</table>\n\n \n</section>\n\n\n\n \n\n\n </div>\n</article>\n\n<!-- links to this doc:\n - api/common/http/testing\n - api/common/http/testing/HttpTestingController\n-->\n<!-- links from this doc:\n - /api\n - api/common\n - api/common/DecimalPipe\n - api/common/http/HttpErrorResponse\n - api/common/http/HttpEvent\n - api/common/http/HttpHeaders\n - api/common/http/HttpRequest\n - api/common/http/testing\n - api/common/http/testing/TestRequest#cancelled\n - api/common/http/testing/TestRequest#constructor\n - api/common/http/testing/TestRequest#constructor()\n - api/common/http/testing/TestRequest#description\n - api/common/http/testing/TestRequest#error\n - api/common/http/testing/TestRequest#event\n - api/common/http/testing/TestRequest#flush\n - api/common/http/testing/TestRequest#methods\n - api/common/http/testing/TestRequest#properties\n - api/common/http/testing/TestRequest#request\n - api/common/http/testing/TestRequest#testrequest\n - api/core/testing/flush\n - https://github.com/angular/angular/edit/master/packages/common/http/testing/src/request.ts?message=docs(common)%3A%20describe%20your%20change...#L103-L113\n - https://github.com/angular/angular/edit/master/packages/common/http/testing/src/request.ts?message=docs(common)%3A%20describe%20your%20change...#L11-L114\n - https://github.com/angular/angular/edit/master/packages/common/http/testing/src/request.ts?message=docs(common)%3A%20describe%20your%20change...#L34-L77\n - https://github.com/angular/angular/edit/master/packages/common/http/testing/src/request.ts?message=docs(common)%3A%20describe%20your%20change...#L78-L102\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/http/testing/src/request.ts#L103-L113\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/http/testing/src/request.ts#L11-L114\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/http/testing/src/request.ts#L34-L77\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/http/testing/src/request.ts#L78-L102\n-->"
|
|
} |