module.d-CnjH8Dlt.d.ts 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926
  1. /**
  2. * @license Angular v19.2.13
  3. * (c) 2010-2025 Google LLC. https://angular.io/
  4. * License: MIT
  5. */
  6. import * as i0 from '@angular/core';
  7. import { ModuleWithProviders } from '@angular/core';
  8. /**
  9. * A token used to manipulate and access values stored in `HttpContext`.
  10. *
  11. * @publicApi
  12. */
  13. declare class HttpContextToken<T> {
  14. readonly defaultValue: () => T;
  15. constructor(defaultValue: () => T);
  16. }
  17. /**
  18. * Http context stores arbitrary user defined values and ensures type safety without
  19. * actually knowing the types. It is backed by a `Map` and guarantees that keys do not clash.
  20. *
  21. * This context is mutable and is shared between cloned requests unless explicitly specified.
  22. *
  23. * @usageNotes
  24. *
  25. * ### Usage Example
  26. *
  27. * ```ts
  28. * // inside cache.interceptors.ts
  29. * export const IS_CACHE_ENABLED = new HttpContextToken<boolean>(() => false);
  30. *
  31. * export class CacheInterceptor implements HttpInterceptor {
  32. *
  33. * intercept(req: HttpRequest<any>, delegate: HttpHandler): Observable<HttpEvent<any>> {
  34. * if (req.context.get(IS_CACHE_ENABLED) === true) {
  35. * return ...;
  36. * }
  37. * return delegate.handle(req);
  38. * }
  39. * }
  40. *
  41. * // inside a service
  42. *
  43. * this.httpClient.get('/api/weather', {
  44. * context: new HttpContext().set(IS_CACHE_ENABLED, true)
  45. * }).subscribe(...);
  46. * ```
  47. *
  48. * @publicApi
  49. */
  50. declare class HttpContext {
  51. private readonly map;
  52. /**
  53. * Store a value in the context. If a value is already present it will be overwritten.
  54. *
  55. * @param token The reference to an instance of `HttpContextToken`.
  56. * @param value The value to store.
  57. *
  58. * @returns A reference to itself for easy chaining.
  59. */
  60. set<T>(token: HttpContextToken<T>, value: T): HttpContext;
  61. /**
  62. * Retrieve the value associated with the given token.
  63. *
  64. * @param token The reference to an instance of `HttpContextToken`.
  65. *
  66. * @returns The stored value or default if one is defined.
  67. */
  68. get<T>(token: HttpContextToken<T>): T;
  69. /**
  70. * Delete the value associated with the given token.
  71. *
  72. * @param token The reference to an instance of `HttpContextToken`.
  73. *
  74. * @returns A reference to itself for easy chaining.
  75. */
  76. delete(token: HttpContextToken<unknown>): HttpContext;
  77. /**
  78. * Checks for existence of a given token.
  79. *
  80. * @param token The reference to an instance of `HttpContextToken`.
  81. *
  82. * @returns True if the token exists, false otherwise.
  83. */
  84. has(token: HttpContextToken<unknown>): boolean;
  85. /**
  86. * @returns a list of tokens currently stored in the context.
  87. */
  88. keys(): IterableIterator<HttpContextToken<unknown>>;
  89. }
  90. /**
  91. * Represents the header configuration options for an HTTP request.
  92. * Instances are immutable. Modifying methods return a cloned
  93. * instance with the change. The original object is never changed.
  94. *
  95. * @publicApi
  96. */
  97. declare class HttpHeaders {
  98. /**
  99. * Internal map of lowercase header names to values.
  100. */
  101. private headers;
  102. /**
  103. * Internal map of lowercased header names to the normalized
  104. * form of the name (the form seen first).
  105. */
  106. private normalizedNames;
  107. /**
  108. * Complete the lazy initialization of this object (needed before reading).
  109. */
  110. private lazyInit;
  111. /**
  112. * Queued updates to be materialized the next initialization.
  113. */
  114. private lazyUpdate;
  115. /** Constructs a new HTTP header object with the given values.*/
  116. constructor(headers?: string | {
  117. [name: string]: string | number | (string | number)[];
  118. } | Headers);
  119. /**
  120. * Checks for existence of a given header.
  121. *
  122. * @param name The header name to check for existence.
  123. *
  124. * @returns True if the header exists, false otherwise.
  125. */
  126. has(name: string): boolean;
  127. /**
  128. * Retrieves the first value of a given header.
  129. *
  130. * @param name The header name.
  131. *
  132. * @returns The value string if the header exists, null otherwise
  133. */
  134. get(name: string): string | null;
  135. /**
  136. * Retrieves the names of the headers.
  137. *
  138. * @returns A list of header names.
  139. */
  140. keys(): string[];
  141. /**
  142. * Retrieves a list of values for a given header.
  143. *
  144. * @param name The header name from which to retrieve values.
  145. *
  146. * @returns A string of values if the header exists, null otherwise.
  147. */
  148. getAll(name: string): string[] | null;
  149. /**
  150. * Appends a new value to the existing set of values for a header
  151. * and returns them in a clone of the original instance.
  152. *
  153. * @param name The header name for which to append the values.
  154. * @param value The value to append.
  155. *
  156. * @returns A clone of the HTTP headers object with the value appended to the given header.
  157. */
  158. append(name: string, value: string | string[]): HttpHeaders;
  159. /**
  160. * Sets or modifies a value for a given header in a clone of the original instance.
  161. * If the header already exists, its value is replaced with the given value
  162. * in the returned object.
  163. *
  164. * @param name The header name.
  165. * @param value The value or values to set or override for the given header.
  166. *
  167. * @returns A clone of the HTTP headers object with the newly set header value.
  168. */
  169. set(name: string, value: string | string[]): HttpHeaders;
  170. /**
  171. * Deletes values for a given header in a clone of the original instance.
  172. *
  173. * @param name The header name.
  174. * @param value The value or values to delete for the given header.
  175. *
  176. * @returns A clone of the HTTP headers object with the given value deleted.
  177. */
  178. delete(name: string, value?: string | string[]): HttpHeaders;
  179. private maybeSetNormalizedName;
  180. private init;
  181. private copyFrom;
  182. private clone;
  183. private applyUpdate;
  184. private addHeaderEntry;
  185. private setHeaderEntries;
  186. }
  187. /**
  188. * A codec for encoding and decoding parameters in URLs.
  189. *
  190. * Used by `HttpParams`.
  191. *
  192. * @publicApi
  193. **/
  194. interface HttpParameterCodec {
  195. encodeKey(key: string): string;
  196. encodeValue(value: string): string;
  197. decodeKey(key: string): string;
  198. decodeValue(value: string): string;
  199. }
  200. /**
  201. * Provides encoding and decoding of URL parameter and query-string values.
  202. *
  203. * Serializes and parses URL parameter keys and values to encode and decode them.
  204. * If you pass URL query parameters without encoding,
  205. * the query parameters can be misinterpreted at the receiving end.
  206. *
  207. *
  208. * @publicApi
  209. */
  210. declare class HttpUrlEncodingCodec implements HttpParameterCodec {
  211. /**
  212. * Encodes a key name for a URL parameter or query-string.
  213. * @param key The key name.
  214. * @returns The encoded key name.
  215. */
  216. encodeKey(key: string): string;
  217. /**
  218. * Encodes the value of a URL parameter or query-string.
  219. * @param value The value.
  220. * @returns The encoded value.
  221. */
  222. encodeValue(value: string): string;
  223. /**
  224. * Decodes an encoded URL parameter or query-string key.
  225. * @param key The encoded key name.
  226. * @returns The decoded key name.
  227. */
  228. decodeKey(key: string): string;
  229. /**
  230. * Decodes an encoded URL parameter or query-string value.
  231. * @param value The encoded value.
  232. * @returns The decoded value.
  233. */
  234. decodeValue(value: string): string;
  235. }
  236. /**
  237. * Options used to construct an `HttpParams` instance.
  238. *
  239. * @publicApi
  240. */
  241. interface HttpParamsOptions {
  242. /**
  243. * String representation of the HTTP parameters in URL-query-string format.
  244. * Mutually exclusive with `fromObject`.
  245. */
  246. fromString?: string;
  247. /** Object map of the HTTP parameters. Mutually exclusive with `fromString`. */
  248. fromObject?: {
  249. [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
  250. };
  251. /** Encoding codec used to parse and serialize the parameters. */
  252. encoder?: HttpParameterCodec;
  253. }
  254. /**
  255. * An HTTP request/response body that represents serialized parameters,
  256. * per the MIME type `application/x-www-form-urlencoded`.
  257. *
  258. * This class is immutable; all mutation operations return a new instance.
  259. *
  260. * @publicApi
  261. */
  262. declare class HttpParams {
  263. private map;
  264. private encoder;
  265. private updates;
  266. private cloneFrom;
  267. constructor(options?: HttpParamsOptions);
  268. /**
  269. * Reports whether the body includes one or more values for a given parameter.
  270. * @param param The parameter name.
  271. * @returns True if the parameter has one or more values,
  272. * false if it has no value or is not present.
  273. */
  274. has(param: string): boolean;
  275. /**
  276. * Retrieves the first value for a parameter.
  277. * @param param The parameter name.
  278. * @returns The first value of the given parameter,
  279. * or `null` if the parameter is not present.
  280. */
  281. get(param: string): string | null;
  282. /**
  283. * Retrieves all values for a parameter.
  284. * @param param The parameter name.
  285. * @returns All values in a string array,
  286. * or `null` if the parameter not present.
  287. */
  288. getAll(param: string): string[] | null;
  289. /**
  290. * Retrieves all the parameters for this body.
  291. * @returns The parameter names in a string array.
  292. */
  293. keys(): string[];
  294. /**
  295. * Appends a new value to existing values for a parameter.
  296. * @param param The parameter name.
  297. * @param value The new value to add.
  298. * @return A new body with the appended value.
  299. */
  300. append(param: string, value: string | number | boolean): HttpParams;
  301. /**
  302. * Constructs a new body with appended values for the given parameter name.
  303. * @param params parameters and values
  304. * @return A new body with the new value.
  305. */
  306. appendAll(params: {
  307. [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
  308. }): HttpParams;
  309. /**
  310. * Replaces the value for a parameter.
  311. * @param param The parameter name.
  312. * @param value The new value.
  313. * @return A new body with the new value.
  314. */
  315. set(param: string, value: string | number | boolean): HttpParams;
  316. /**
  317. * Removes a given value or all values from a parameter.
  318. * @param param The parameter name.
  319. * @param value The value to remove, if provided.
  320. * @return A new body with the given value removed, or with all values
  321. * removed if no value is specified.
  322. */
  323. delete(param: string, value?: string | number | boolean): HttpParams;
  324. /**
  325. * Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
  326. * separated by `&`s.
  327. */
  328. toString(): string;
  329. private clone;
  330. private init;
  331. }
  332. /**
  333. * An outgoing HTTP request with an optional typed body.
  334. *
  335. * `HttpRequest` represents an outgoing request, including URL, method,
  336. * headers, body, and other request configuration options. Instances should be
  337. * assumed to be immutable. To modify a `HttpRequest`, the `clone`
  338. * method should be used.
  339. *
  340. * @publicApi
  341. */
  342. declare class HttpRequest<T> {
  343. readonly url: string;
  344. /**
  345. * The request body, or `null` if one isn't set.
  346. *
  347. * Bodies are not enforced to be immutable, as they can include a reference to any
  348. * user-defined data type. However, interceptors should take care to preserve
  349. * idempotence by treating them as such.
  350. */
  351. readonly body: T | null;
  352. /**
  353. * Outgoing headers for this request.
  354. */
  355. readonly headers: HttpHeaders;
  356. /**
  357. * Shared and mutable context that can be used by interceptors
  358. */
  359. readonly context: HttpContext;
  360. /**
  361. * Whether this request should be made in a way that exposes progress events.
  362. *
  363. * Progress events are expensive (change detection runs on each event) and so
  364. * they should only be requested if the consumer intends to monitor them.
  365. *
  366. * Note: The `FetchBackend` doesn't support progress report on uploads.
  367. */
  368. readonly reportProgress: boolean;
  369. /**
  370. * Whether this request should be sent with outgoing credentials (cookies).
  371. */
  372. readonly withCredentials: boolean;
  373. /**
  374. * The expected response type of the server.
  375. *
  376. * This is used to parse the response appropriately before returning it to
  377. * the requestee.
  378. */
  379. readonly responseType: 'arraybuffer' | 'blob' | 'json' | 'text';
  380. /**
  381. * The outgoing HTTP request method.
  382. */
  383. readonly method: string;
  384. /**
  385. * Outgoing URL parameters.
  386. *
  387. * To pass a string representation of HTTP parameters in the URL-query-string format,
  388. * the `HttpParamsOptions`' `fromString` may be used. For example:
  389. *
  390. * ```ts
  391. * new HttpParams({fromString: 'angular=awesome'})
  392. * ```
  393. */
  394. readonly params: HttpParams;
  395. /**
  396. * The outgoing URL with all URL parameters set.
  397. */
  398. readonly urlWithParams: string;
  399. /**
  400. * The HttpTransferCache option for the request
  401. */
  402. readonly transferCache?: {
  403. includeHeaders?: string[];
  404. } | boolean;
  405. constructor(method: 'GET' | 'HEAD', url: string, init?: {
  406. headers?: HttpHeaders;
  407. context?: HttpContext;
  408. reportProgress?: boolean;
  409. params?: HttpParams;
  410. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  411. withCredentials?: boolean;
  412. /**
  413. * This property accepts either a boolean to enable/disable transferring cache for eligible
  414. * requests performed using `HttpClient`, or an object, which allows to configure cache
  415. * parameters, such as which headers should be included (no headers are included by default).
  416. *
  417. * Setting this property will override the options passed to `provideClientHydration()` for this
  418. * particular request
  419. */
  420. transferCache?: {
  421. includeHeaders?: string[];
  422. } | boolean;
  423. });
  424. constructor(method: 'DELETE' | 'JSONP' | 'OPTIONS', url: string, init?: {
  425. headers?: HttpHeaders;
  426. context?: HttpContext;
  427. reportProgress?: boolean;
  428. params?: HttpParams;
  429. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  430. withCredentials?: boolean;
  431. });
  432. constructor(method: 'POST', url: string, body: T | null, init?: {
  433. headers?: HttpHeaders;
  434. context?: HttpContext;
  435. reportProgress?: boolean;
  436. params?: HttpParams;
  437. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  438. withCredentials?: boolean;
  439. /**
  440. * This property accepts either a boolean to enable/disable transferring cache for eligible
  441. * requests performed using `HttpClient`, or an object, which allows to configure cache
  442. * parameters, such as which headers should be included (no headers are included by default).
  443. *
  444. * Setting this property will override the options passed to `provideClientHydration()` for this
  445. * particular request
  446. */
  447. transferCache?: {
  448. includeHeaders?: string[];
  449. } | boolean;
  450. });
  451. constructor(method: 'PUT' | 'PATCH', url: string, body: T | null, init?: {
  452. headers?: HttpHeaders;
  453. context?: HttpContext;
  454. reportProgress?: boolean;
  455. params?: HttpParams;
  456. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  457. withCredentials?: boolean;
  458. });
  459. constructor(method: string, url: string, body: T | null, init?: {
  460. headers?: HttpHeaders;
  461. context?: HttpContext;
  462. reportProgress?: boolean;
  463. params?: HttpParams;
  464. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  465. withCredentials?: boolean;
  466. /**
  467. * This property accepts either a boolean to enable/disable transferring cache for eligible
  468. * requests performed using `HttpClient`, or an object, which allows to configure cache
  469. * parameters, such as which headers should be included (no headers are included by default).
  470. *
  471. * Setting this property will override the options passed to `provideClientHydration()` for this
  472. * particular request
  473. */
  474. transferCache?: {
  475. includeHeaders?: string[];
  476. } | boolean;
  477. });
  478. /**
  479. * Transform the free-form body into a serialized format suitable for
  480. * transmission to the server.
  481. */
  482. serializeBody(): ArrayBuffer | Blob | FormData | URLSearchParams | string | null;
  483. /**
  484. * Examine the body and attempt to infer an appropriate MIME type
  485. * for it.
  486. *
  487. * If no such type can be inferred, this method will return `null`.
  488. */
  489. detectContentTypeHeader(): string | null;
  490. clone(): HttpRequest<T>;
  491. clone(update: {
  492. headers?: HttpHeaders;
  493. context?: HttpContext;
  494. reportProgress?: boolean;
  495. params?: HttpParams;
  496. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  497. withCredentials?: boolean;
  498. transferCache?: {
  499. includeHeaders?: string[];
  500. } | boolean;
  501. body?: T | null;
  502. method?: string;
  503. url?: string;
  504. setHeaders?: {
  505. [name: string]: string | string[];
  506. };
  507. setParams?: {
  508. [param: string]: string;
  509. };
  510. }): HttpRequest<T>;
  511. clone<V>(update: {
  512. headers?: HttpHeaders;
  513. context?: HttpContext;
  514. reportProgress?: boolean;
  515. params?: HttpParams;
  516. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  517. withCredentials?: boolean;
  518. transferCache?: {
  519. includeHeaders?: string[];
  520. } | boolean;
  521. body?: V | null;
  522. method?: string;
  523. url?: string;
  524. setHeaders?: {
  525. [name: string]: string | string[];
  526. };
  527. setParams?: {
  528. [param: string]: string;
  529. };
  530. }): HttpRequest<V>;
  531. }
  532. /**
  533. * Type enumeration for the different kinds of `HttpEvent`.
  534. *
  535. * @publicApi
  536. */
  537. declare enum HttpEventType {
  538. /**
  539. * The request was sent out over the wire.
  540. */
  541. Sent = 0,
  542. /**
  543. * An upload progress event was received.
  544. *
  545. * Note: The `FetchBackend` doesn't support progress report on uploads.
  546. */
  547. UploadProgress = 1,
  548. /**
  549. * The response status code and headers were received.
  550. */
  551. ResponseHeader = 2,
  552. /**
  553. * A download progress event was received.
  554. */
  555. DownloadProgress = 3,
  556. /**
  557. * The full response including the body was received.
  558. */
  559. Response = 4,
  560. /**
  561. * A custom event from an interceptor or a backend.
  562. */
  563. User = 5
  564. }
  565. /**
  566. * Base interface for progress events.
  567. *
  568. * @publicApi
  569. */
  570. interface HttpProgressEvent {
  571. /**
  572. * Progress event type is either upload or download.
  573. */
  574. type: HttpEventType.DownloadProgress | HttpEventType.UploadProgress;
  575. /**
  576. * Number of bytes uploaded or downloaded.
  577. */
  578. loaded: number;
  579. /**
  580. * Total number of bytes to upload or download. Depending on the request or
  581. * response, this may not be computable and thus may not be present.
  582. */
  583. total?: number;
  584. }
  585. /**
  586. * A download progress event.
  587. *
  588. * @publicApi
  589. */
  590. interface HttpDownloadProgressEvent extends HttpProgressEvent {
  591. type: HttpEventType.DownloadProgress;
  592. /**
  593. * The partial response body as downloaded so far.
  594. *
  595. * Only present if the responseType was `text`.
  596. */
  597. partialText?: string;
  598. }
  599. /**
  600. * An upload progress event.
  601. *
  602. * Note: The `FetchBackend` doesn't support progress report on uploads.
  603. *
  604. * @publicApi
  605. */
  606. interface HttpUploadProgressEvent extends HttpProgressEvent {
  607. type: HttpEventType.UploadProgress;
  608. }
  609. /**
  610. * An event indicating that the request was sent to the server. Useful
  611. * when a request may be retried multiple times, to distinguish between
  612. * retries on the final event stream.
  613. *
  614. * @publicApi
  615. */
  616. interface HttpSentEvent {
  617. type: HttpEventType.Sent;
  618. }
  619. /**
  620. * A user-defined event.
  621. *
  622. * Grouping all custom events under this type ensures they will be handled
  623. * and forwarded by all implementations of interceptors.
  624. *
  625. * @publicApi
  626. */
  627. interface HttpUserEvent<T> {
  628. type: HttpEventType.User;
  629. }
  630. /**
  631. * Union type for all possible events on the response stream.
  632. *
  633. * Typed according to the expected type of the response.
  634. *
  635. * @publicApi
  636. */
  637. type HttpEvent<T> = HttpSentEvent | HttpHeaderResponse | HttpResponse<T> | HttpProgressEvent | HttpUserEvent<T>;
  638. /**
  639. * Base class for both `HttpResponse` and `HttpHeaderResponse`.
  640. *
  641. * @publicApi
  642. */
  643. declare abstract class HttpResponseBase {
  644. /**
  645. * All response headers.
  646. */
  647. readonly headers: HttpHeaders;
  648. /**
  649. * Response status code.
  650. */
  651. readonly status: number;
  652. /**
  653. * Textual description of response status code, defaults to OK.
  654. *
  655. * Do not depend on this.
  656. */
  657. readonly statusText: string;
  658. /**
  659. * URL of the resource retrieved, or null if not available.
  660. */
  661. readonly url: string | null;
  662. /**
  663. * Whether the status code falls in the 2xx range.
  664. */
  665. readonly ok: boolean;
  666. /**
  667. * Type of the response, narrowed to either the full response or the header.
  668. */
  669. readonly type: HttpEventType.Response | HttpEventType.ResponseHeader;
  670. /**
  671. * Super-constructor for all responses.
  672. *
  673. * The single parameter accepted is an initialization hash. Any properties
  674. * of the response passed there will override the default values.
  675. */
  676. constructor(init: {
  677. headers?: HttpHeaders;
  678. status?: number;
  679. statusText?: string;
  680. url?: string;
  681. }, defaultStatus?: number, defaultStatusText?: string);
  682. }
  683. /**
  684. * A partial HTTP response which only includes the status and header data,
  685. * but no response body.
  686. *
  687. * `HttpHeaderResponse` is a `HttpEvent` available on the response
  688. * event stream, only when progress events are requested.
  689. *
  690. * @publicApi
  691. */
  692. declare class HttpHeaderResponse extends HttpResponseBase {
  693. /**
  694. * Create a new `HttpHeaderResponse` with the given parameters.
  695. */
  696. constructor(init?: {
  697. headers?: HttpHeaders;
  698. status?: number;
  699. statusText?: string;
  700. url?: string;
  701. });
  702. readonly type: HttpEventType.ResponseHeader;
  703. /**
  704. * Copy this `HttpHeaderResponse`, overriding its contents with the
  705. * given parameter hash.
  706. */
  707. clone(update?: {
  708. headers?: HttpHeaders;
  709. status?: number;
  710. statusText?: string;
  711. url?: string;
  712. }): HttpHeaderResponse;
  713. }
  714. /**
  715. * A full HTTP response, including a typed response body (which may be `null`
  716. * if one was not returned).
  717. *
  718. * `HttpResponse` is a `HttpEvent` available on the response event
  719. * stream.
  720. *
  721. * @publicApi
  722. */
  723. declare class HttpResponse<T> extends HttpResponseBase {
  724. /**
  725. * The response body, or `null` if one was not returned.
  726. */
  727. readonly body: T | null;
  728. /**
  729. * Construct a new `HttpResponse`.
  730. */
  731. constructor(init?: {
  732. body?: T | null;
  733. headers?: HttpHeaders;
  734. status?: number;
  735. statusText?: string;
  736. url?: string;
  737. });
  738. readonly type: HttpEventType.Response;
  739. clone(): HttpResponse<T>;
  740. clone(update: {
  741. headers?: HttpHeaders;
  742. status?: number;
  743. statusText?: string;
  744. url?: string;
  745. }): HttpResponse<T>;
  746. clone<V>(update: {
  747. body?: V | null;
  748. headers?: HttpHeaders;
  749. status?: number;
  750. statusText?: string;
  751. url?: string;
  752. }): HttpResponse<V>;
  753. }
  754. /**
  755. * A response that represents an error or failure, either from a
  756. * non-successful HTTP status, an error while executing the request,
  757. * or some other failure which occurred during the parsing of the response.
  758. *
  759. * Any error returned on the `Observable` response stream will be
  760. * wrapped in an `HttpErrorResponse` to provide additional context about
  761. * the state of the HTTP layer when the error occurred. The error property
  762. * will contain either a wrapped Error object or the error response returned
  763. * from the server.
  764. *
  765. * @publicApi
  766. */
  767. declare class HttpErrorResponse extends HttpResponseBase implements Error {
  768. readonly name = "HttpErrorResponse";
  769. readonly message: string;
  770. readonly error: any | null;
  771. /**
  772. * Errors are never okay, even when the status code is in the 2xx success range.
  773. */
  774. readonly ok = false;
  775. constructor(init: {
  776. error?: any;
  777. headers?: HttpHeaders;
  778. status?: number;
  779. statusText?: string;
  780. url?: string;
  781. });
  782. }
  783. /**
  784. * Http status codes.
  785. * As per https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
  786. * @publicApi
  787. */
  788. declare enum HttpStatusCode {
  789. Continue = 100,
  790. SwitchingProtocols = 101,
  791. Processing = 102,
  792. EarlyHints = 103,
  793. Ok = 200,
  794. Created = 201,
  795. Accepted = 202,
  796. NonAuthoritativeInformation = 203,
  797. NoContent = 204,
  798. ResetContent = 205,
  799. PartialContent = 206,
  800. MultiStatus = 207,
  801. AlreadyReported = 208,
  802. ImUsed = 226,
  803. MultipleChoices = 300,
  804. MovedPermanently = 301,
  805. Found = 302,
  806. SeeOther = 303,
  807. NotModified = 304,
  808. UseProxy = 305,
  809. Unused = 306,
  810. TemporaryRedirect = 307,
  811. PermanentRedirect = 308,
  812. BadRequest = 400,
  813. Unauthorized = 401,
  814. PaymentRequired = 402,
  815. Forbidden = 403,
  816. NotFound = 404,
  817. MethodNotAllowed = 405,
  818. NotAcceptable = 406,
  819. ProxyAuthenticationRequired = 407,
  820. RequestTimeout = 408,
  821. Conflict = 409,
  822. Gone = 410,
  823. LengthRequired = 411,
  824. PreconditionFailed = 412,
  825. PayloadTooLarge = 413,
  826. UriTooLong = 414,
  827. UnsupportedMediaType = 415,
  828. RangeNotSatisfiable = 416,
  829. ExpectationFailed = 417,
  830. ImATeapot = 418,
  831. MisdirectedRequest = 421,
  832. UnprocessableEntity = 422,
  833. Locked = 423,
  834. FailedDependency = 424,
  835. TooEarly = 425,
  836. UpgradeRequired = 426,
  837. PreconditionRequired = 428,
  838. TooManyRequests = 429,
  839. RequestHeaderFieldsTooLarge = 431,
  840. UnavailableForLegalReasons = 451,
  841. InternalServerError = 500,
  842. NotImplemented = 501,
  843. BadGateway = 502,
  844. ServiceUnavailable = 503,
  845. GatewayTimeout = 504,
  846. HttpVersionNotSupported = 505,
  847. VariantAlsoNegotiates = 506,
  848. InsufficientStorage = 507,
  849. LoopDetected = 508,
  850. NotExtended = 510,
  851. NetworkAuthenticationRequired = 511
  852. }
  853. /**
  854. * Configures XSRF protection support for outgoing requests.
  855. *
  856. * For a server that supports a cookie-based XSRF protection system,
  857. * use directly to configure XSRF protection with the correct
  858. * cookie and header names.
  859. *
  860. * If no names are supplied, the default cookie name is `XSRF-TOKEN`
  861. * and the default header name is `X-XSRF-TOKEN`.
  862. *
  863. * @publicApi
  864. * @deprecated Use withXsrfConfiguration({cookieName: 'XSRF-TOKEN', headerName: 'X-XSRF-TOKEN'}) as
  865. * providers instead or `withNoXsrfProtection` if you want to disabled XSRF protection.
  866. */
  867. declare class HttpClientXsrfModule {
  868. /**
  869. * Disable the default XSRF protection.
  870. */
  871. static disable(): ModuleWithProviders<HttpClientXsrfModule>;
  872. /**
  873. * Configure XSRF protection.
  874. * @param options An object that can specify either or both
  875. * cookie name or header name.
  876. * - Cookie name default is `XSRF-TOKEN`.
  877. * - Header name default is `X-XSRF-TOKEN`.
  878. *
  879. */
  880. static withOptions(options?: {
  881. cookieName?: string;
  882. headerName?: string;
  883. }): ModuleWithProviders<HttpClientXsrfModule>;
  884. static ɵfac: i0.ɵɵFactoryDeclaration<HttpClientXsrfModule, never>;
  885. static ɵmod: i0.ɵɵNgModuleDeclaration<HttpClientXsrfModule, never, never, never>;
  886. static ɵinj: i0.ɵɵInjectorDeclaration<HttpClientXsrfModule>;
  887. }
  888. /**
  889. * Configures the dependency injector for `HttpClient`
  890. * with supporting services for XSRF. Automatically imported by `HttpClientModule`.
  891. *
  892. * You can add interceptors to the chain behind `HttpClient` by binding them to the
  893. * multiprovider for built-in DI token `HTTP_INTERCEPTORS`.
  894. *
  895. * @publicApi
  896. * @deprecated use `provideHttpClient(withInterceptorsFromDi())` as providers instead
  897. */
  898. declare class HttpClientModule {
  899. static ɵfac: i0.ɵɵFactoryDeclaration<HttpClientModule, never>;
  900. static ɵmod: i0.ɵɵNgModuleDeclaration<HttpClientModule, never, never, never>;
  901. static ɵinj: i0.ɵɵInjectorDeclaration<HttpClientModule>;
  902. }
  903. /**
  904. * Configures the dependency injector for `HttpClient`
  905. * with supporting services for JSONP.
  906. * Without this module, Jsonp requests reach the backend
  907. * with method JSONP, where they are rejected.
  908. *
  909. * @publicApi
  910. * @deprecated `withJsonpSupport()` as providers instead
  911. */
  912. declare class HttpClientJsonpModule {
  913. static ɵfac: i0.ɵɵFactoryDeclaration<HttpClientJsonpModule, never>;
  914. static ɵmod: i0.ɵɵNgModuleDeclaration<HttpClientJsonpModule, never, never, never>;
  915. static ɵinj: i0.ɵɵInjectorDeclaration<HttpClientJsonpModule>;
  916. }
  917. export { HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpContext, HttpContextToken, HttpErrorResponse, HttpEventType, HttpHeaderResponse, HttpHeaders, HttpParams, HttpRequest, HttpResponse, HttpResponseBase, HttpStatusCode, HttpUrlEncodingCodec };
  918. export type { HttpDownloadProgressEvent, HttpEvent, HttpParameterCodec, HttpParamsOptions, HttpProgressEvent, HttpSentEvent, HttpUploadProgressEvent, HttpUserEvent };