index.d.ts 132 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349
  1. /**
  2. * @license Angular v19.2.13
  3. * (c) 2010-2025 Google LLC. https://angular.io/
  4. * License: MIT
  5. */
  6. import { Observable } from 'rxjs';
  7. import { HttpRequest, HttpEvent, HttpHeaders, HttpContext, HttpParams, HttpResponse, HttpProgressEvent } from '../module.d-CnjH8Dlt.js';
  8. export { HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpContextToken, HttpDownloadProgressEvent, HttpErrorResponse, HttpEventType, HttpHeaderResponse, HttpParameterCodec, HttpParamsOptions, HttpResponseBase, HttpSentEvent, HttpStatusCode, HttpUploadProgressEvent, HttpUrlEncodingCodec, HttpUserEvent } from '../module.d-CnjH8Dlt.js';
  9. import * as i0 from '@angular/core';
  10. import { InjectionToken, EnvironmentInjector, Provider, EnvironmentProviders, WritableResource, ResourceRef, Signal, Injector, ValueEqualityFn } from '@angular/core';
  11. import { XhrFactory } from '../xhr.d-D_1kTQR5.js';
  12. /**
  13. * Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a
  14. * `HttpResponse`.
  15. *
  16. * `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the
  17. * first interceptor in the chain, which dispatches to the second, etc, eventually reaching the
  18. * `HttpBackend`.
  19. *
  20. * In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain.
  21. *
  22. * @publicApi
  23. */
  24. declare abstract class HttpHandler {
  25. abstract handle(req: HttpRequest<any>): Observable<HttpEvent<any>>;
  26. }
  27. /**
  28. * A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend.
  29. *
  30. * Interceptors sit between the `HttpClient` interface and the `HttpBackend`.
  31. *
  32. * When injected, `HttpBackend` dispatches requests directly to the backend, without going
  33. * through the interceptor chain.
  34. *
  35. * @publicApi
  36. */
  37. declare abstract class HttpBackend implements HttpHandler {
  38. abstract handle(req: HttpRequest<any>): Observable<HttpEvent<any>>;
  39. }
  40. /**
  41. * Performs HTTP requests.
  42. * This service is available as an injectable class, with methods to perform HTTP requests.
  43. * Each request method has multiple signatures, and the return type varies based on
  44. * the signature that is called (mainly the values of `observe` and `responseType`).
  45. *
  46. * Note that the `responseType` *options* value is a String that identifies the
  47. * single data type of the response.
  48. * A single overload version of the method handles each response type.
  49. * The value of `responseType` cannot be a union, as the combined signature could imply.
  50. *
  51. * @usageNotes
  52. *
  53. * ### HTTP Request Example
  54. *
  55. * ```ts
  56. * // GET heroes whose name contains search term
  57. * searchHeroes(term: string): observable<Hero[]>{
  58. *
  59. * const params = new HttpParams({fromString: 'name=term'});
  60. * return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params});
  61. * }
  62. * ```
  63. *
  64. * Alternatively, the parameter string can be used without invoking HttpParams
  65. * by directly joining to the URL.
  66. * ```ts
  67. * this.httpClient.request('GET', this.heroesUrl + '?' + 'name=term', {responseType:'json'});
  68. * ```
  69. *
  70. *
  71. * ### JSONP Example
  72. * ```ts
  73. * requestJsonp(url, callback = 'callback') {
  74. * return this.httpClient.jsonp(this.heroesURL, callback);
  75. * }
  76. * ```
  77. *
  78. * ### PATCH Example
  79. * ```ts
  80. * // PATCH one of the heroes' name
  81. * patchHero (id: number, heroName: string): Observable<{}> {
  82. * const url = `${this.heroesUrl}/${id}`; // PATCH api/heroes/42
  83. * return this.httpClient.patch(url, {name: heroName}, httpOptions)
  84. * .pipe(catchError(this.handleError('patchHero')));
  85. * }
  86. * ```
  87. *
  88. * @see [HTTP Guide](guide/http)
  89. * @see [HTTP Request](api/common/http/HttpRequest)
  90. *
  91. * @publicApi
  92. */
  93. declare class HttpClient {
  94. private handler;
  95. constructor(handler: HttpHandler);
  96. /**
  97. * Sends an `HttpRequest` and returns a stream of `HttpEvent`s.
  98. *
  99. * @return An `Observable` of the response, with the response body as a stream of `HttpEvent`s.
  100. */
  101. request<R>(req: HttpRequest<any>): Observable<HttpEvent<R>>;
  102. /**
  103. * Constructs a request that interprets the body as an `ArrayBuffer` and returns the response in
  104. * an `ArrayBuffer`.
  105. *
  106. * @param method The HTTP method.
  107. * @param url The endpoint URL.
  108. * @param options The HTTP options to send with the request.
  109. *
  110. *
  111. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  112. */
  113. request(method: string, url: string, options: {
  114. body?: any;
  115. headers?: HttpHeaders | Record<string, string | string[]>;
  116. context?: HttpContext;
  117. observe?: 'body';
  118. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  119. reportProgress?: boolean;
  120. responseType: 'arraybuffer';
  121. withCredentials?: boolean;
  122. transferCache?: {
  123. includeHeaders?: string[];
  124. } | boolean;
  125. }): Observable<ArrayBuffer>;
  126. /**
  127. * Constructs a request that interprets the body as a blob and returns
  128. * the response as a blob.
  129. *
  130. * @param method The HTTP method.
  131. * @param url The endpoint URL.
  132. * @param options The HTTP options to send with the request.
  133. *
  134. * @return An `Observable` of the response, with the response body of type `Blob`.
  135. */
  136. request(method: string, url: string, options: {
  137. body?: any;
  138. headers?: HttpHeaders | Record<string, string | string[]>;
  139. context?: HttpContext;
  140. observe?: 'body';
  141. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  142. reportProgress?: boolean;
  143. responseType: 'blob';
  144. withCredentials?: boolean;
  145. transferCache?: {
  146. includeHeaders?: string[];
  147. } | boolean;
  148. }): Observable<Blob>;
  149. /**
  150. * Constructs a request that interprets the body as a text string and
  151. * returns a string value.
  152. *
  153. * @param method The HTTP method.
  154. * @param url The endpoint URL.
  155. * @param options The HTTP options to send with the request.
  156. *
  157. * @return An `Observable` of the response, with the response body of type string.
  158. */
  159. request(method: string, url: string, options: {
  160. body?: any;
  161. headers?: HttpHeaders | Record<string, string | string[]>;
  162. context?: HttpContext;
  163. observe?: 'body';
  164. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  165. reportProgress?: boolean;
  166. responseType: 'text';
  167. withCredentials?: boolean;
  168. transferCache?: {
  169. includeHeaders?: string[];
  170. } | boolean;
  171. }): Observable<string>;
  172. /**
  173. * Constructs a request that interprets the body as an `ArrayBuffer` and returns the
  174. * the full event stream.
  175. *
  176. * @param method The HTTP method.
  177. * @param url The endpoint URL.
  178. * @param options The HTTP options to send with the request.
  179. *
  180. * @return An `Observable` of the response, with the response body as an array of `HttpEvent`s for
  181. * the request.
  182. */
  183. request(method: string, url: string, options: {
  184. body?: any;
  185. headers?: HttpHeaders | Record<string, string | string[]>;
  186. context?: HttpContext;
  187. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  188. observe: 'events';
  189. reportProgress?: boolean;
  190. responseType: 'arraybuffer';
  191. withCredentials?: boolean;
  192. transferCache?: {
  193. includeHeaders?: string[];
  194. } | boolean;
  195. }): Observable<HttpEvent<ArrayBuffer>>;
  196. /**
  197. * Constructs a request that interprets the body as a `Blob` and returns
  198. * the full event stream.
  199. *
  200. * @param method The HTTP method.
  201. * @param url The endpoint URL.
  202. * @param options The HTTP options to send with the request.
  203. *
  204. * @return An `Observable` of all `HttpEvent`s for the request,
  205. * with the response body of type `Blob`.
  206. */
  207. request(method: string, url: string, options: {
  208. body?: any;
  209. headers?: HttpHeaders | Record<string, string | string[]>;
  210. observe: 'events';
  211. context?: HttpContext;
  212. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  213. reportProgress?: boolean;
  214. responseType: 'blob';
  215. withCredentials?: boolean;
  216. transferCache?: {
  217. includeHeaders?: string[];
  218. } | boolean;
  219. }): Observable<HttpEvent<Blob>>;
  220. /**
  221. * Constructs a request which interprets the body as a text string and returns the full event
  222. * stream.
  223. *
  224. * @param method The HTTP method.
  225. * @param url The endpoint URL.
  226. * @param options The HTTP options to send with the request.
  227. *
  228. * @return An `Observable` of all `HttpEvent`s for the request,
  229. * with the response body of type string.
  230. */
  231. request(method: string, url: string, options: {
  232. body?: any;
  233. headers?: HttpHeaders | Record<string, string | string[]>;
  234. observe: 'events';
  235. context?: HttpContext;
  236. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  237. reportProgress?: boolean;
  238. responseType: 'text';
  239. withCredentials?: boolean;
  240. transferCache?: {
  241. includeHeaders?: string[];
  242. } | boolean;
  243. }): Observable<HttpEvent<string>>;
  244. /**
  245. * Constructs a request which interprets the body as a JavaScript object and returns the full
  246. * event stream.
  247. *
  248. * @param method The HTTP method.
  249. * @param url The endpoint URL.
  250. * @param options The HTTP options to send with the request.
  251. *
  252. * @return An `Observable` of all `HttpEvent`s for the request,
  253. * with the response body of type `Object`.
  254. */
  255. request(method: string, url: string, options: {
  256. body?: any;
  257. headers?: HttpHeaders | Record<string, string | string[]>;
  258. context?: HttpContext;
  259. reportProgress?: boolean;
  260. observe: 'events';
  261. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  262. responseType?: 'json';
  263. withCredentials?: boolean;
  264. transferCache?: {
  265. includeHeaders?: string[];
  266. } | boolean;
  267. }): Observable<HttpEvent<any>>;
  268. /**
  269. * Constructs a request which interprets the body as a JavaScript object and returns the full
  270. * event stream.
  271. *
  272. * @param method The HTTP method.
  273. * @param url The endpoint URL.
  274. * @param options The HTTP options to send with the request.
  275. *
  276. * @return An `Observable` of all `HttpEvent`s for the request,
  277. * with the response body of type `R`.
  278. */
  279. request<R>(method: string, url: string, options: {
  280. body?: any;
  281. headers?: HttpHeaders | Record<string, string | string[]>;
  282. context?: HttpContext;
  283. reportProgress?: boolean;
  284. observe: 'events';
  285. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  286. responseType?: 'json';
  287. withCredentials?: boolean;
  288. transferCache?: {
  289. includeHeaders?: string[];
  290. } | boolean;
  291. }): Observable<HttpEvent<R>>;
  292. /**
  293. * Constructs a request which interprets the body as an `ArrayBuffer`
  294. * and returns the full `HttpResponse`.
  295. *
  296. * @param method The HTTP method.
  297. * @param url The endpoint URL.
  298. * @param options The HTTP options to send with the request.
  299. *
  300. * @return An `Observable` of the `HttpResponse`, with the response body as an `ArrayBuffer`.
  301. */
  302. request(method: string, url: string, options: {
  303. body?: any;
  304. headers?: HttpHeaders | Record<string, string | string[]>;
  305. observe: 'response';
  306. context?: HttpContext;
  307. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  308. reportProgress?: boolean;
  309. responseType: 'arraybuffer';
  310. withCredentials?: boolean;
  311. transferCache?: {
  312. includeHeaders?: string[];
  313. } | boolean;
  314. }): Observable<HttpResponse<ArrayBuffer>>;
  315. /**
  316. * Constructs a request which interprets the body as a `Blob` and returns the full `HttpResponse`.
  317. *
  318. * @param method The HTTP method.
  319. * @param url The endpoint URL.
  320. * @param options The HTTP options to send with the request.
  321. *
  322. * @return An `Observable` of the `HttpResponse`, with the response body of type `Blob`.
  323. */
  324. request(method: string, url: string, options: {
  325. body?: any;
  326. headers?: HttpHeaders | Record<string, string | string[]>;
  327. observe: 'response';
  328. context?: HttpContext;
  329. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  330. reportProgress?: boolean;
  331. responseType: 'blob';
  332. withCredentials?: boolean;
  333. transferCache?: {
  334. includeHeaders?: string[];
  335. } | boolean;
  336. }): Observable<HttpResponse<Blob>>;
  337. /**
  338. * Constructs a request which interprets the body as a text stream and returns the full
  339. * `HttpResponse`.
  340. *
  341. * @param method The HTTP method.
  342. * @param url The endpoint URL.
  343. * @param options The HTTP options to send with the request.
  344. *
  345. * @return An `Observable` of the HTTP response, with the response body of type string.
  346. */
  347. request(method: string, url: string, options: {
  348. body?: any;
  349. headers?: HttpHeaders | Record<string, string | string[]>;
  350. observe: 'response';
  351. context?: HttpContext;
  352. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  353. reportProgress?: boolean;
  354. responseType: 'text';
  355. withCredentials?: boolean;
  356. transferCache?: {
  357. includeHeaders?: string[];
  358. } | boolean;
  359. }): Observable<HttpResponse<string>>;
  360. /**
  361. * Constructs a request which interprets the body as a JavaScript object and returns the full
  362. * `HttpResponse`.
  363. *
  364. * @param method The HTTP method.
  365. * @param url The endpoint URL.
  366. * @param options The HTTP options to send with the request.
  367. *
  368. * @return An `Observable` of the full `HttpResponse`,
  369. * with the response body of type `Object`.
  370. */
  371. request(method: string, url: string, options: {
  372. body?: any;
  373. headers?: HttpHeaders | Record<string, string | string[]>;
  374. context?: HttpContext;
  375. reportProgress?: boolean;
  376. observe: 'response';
  377. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  378. responseType?: 'json';
  379. withCredentials?: boolean;
  380. }): Observable<HttpResponse<Object>>;
  381. /**
  382. * Constructs a request which interprets the body as a JavaScript object and returns
  383. * the full `HttpResponse` with the response body in the requested type.
  384. *
  385. * @param method The HTTP method.
  386. * @param url The endpoint URL.
  387. * @param options The HTTP options to send with the request.
  388. *
  389. * @return An `Observable` of the full `HttpResponse`, with the response body of type `R`.
  390. */
  391. request<R>(method: string, url: string, options: {
  392. body?: any;
  393. headers?: HttpHeaders | Record<string, string | string[]>;
  394. context?: HttpContext;
  395. reportProgress?: boolean;
  396. observe: 'response';
  397. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  398. responseType?: 'json';
  399. withCredentials?: boolean;
  400. transferCache?: {
  401. includeHeaders?: string[];
  402. } | boolean;
  403. }): Observable<HttpResponse<R>>;
  404. /**
  405. * Constructs a request which interprets the body as a JavaScript object and returns the full
  406. * `HttpResponse` as a JavaScript object.
  407. *
  408. * @param method The HTTP method.
  409. * @param url The endpoint URL.
  410. * @param options The HTTP options to send with the request.
  411. *
  412. * @return An `Observable` of the `HttpResponse`, with the response body of type `Object`.
  413. */
  414. request(method: string, url: string, options?: {
  415. body?: any;
  416. headers?: HttpHeaders | Record<string, string | string[]>;
  417. context?: HttpContext;
  418. observe?: 'body';
  419. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  420. responseType?: 'json';
  421. reportProgress?: boolean;
  422. withCredentials?: boolean;
  423. transferCache?: {
  424. includeHeaders?: string[];
  425. } | boolean;
  426. }): Observable<Object>;
  427. /**
  428. * Constructs a request which interprets the body as a JavaScript object
  429. * with the response body of the requested type.
  430. *
  431. * @param method The HTTP method.
  432. * @param url The endpoint URL.
  433. * @param options The HTTP options to send with the request.
  434. *
  435. * @return An `Observable` of the `HttpResponse`, with the response body of type `R`.
  436. */
  437. request<R>(method: string, url: string, options?: {
  438. body?: any;
  439. headers?: HttpHeaders | Record<string, string | string[]>;
  440. context?: HttpContext;
  441. observe?: 'body';
  442. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  443. responseType?: 'json';
  444. reportProgress?: boolean;
  445. withCredentials?: boolean;
  446. transferCache?: {
  447. includeHeaders?: string[];
  448. } | boolean;
  449. }): Observable<R>;
  450. /**
  451. * Constructs a request where response type and requested observable are not known statically.
  452. *
  453. * @param method The HTTP method.
  454. * @param url The endpoint URL.
  455. * @param options The HTTP options to send with the request.
  456. *
  457. * @return An `Observable` of the requested response, with body of type `any`.
  458. */
  459. request(method: string, url: string, options?: {
  460. body?: any;
  461. headers?: HttpHeaders | Record<string, string | string[]>;
  462. context?: HttpContext;
  463. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  464. observe?: 'body' | 'events' | 'response';
  465. reportProgress?: boolean;
  466. responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
  467. withCredentials?: boolean;
  468. transferCache?: {
  469. includeHeaders?: string[];
  470. } | boolean;
  471. }): Observable<any>;
  472. /**
  473. * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer`
  474. * and returns the response as an `ArrayBuffer`.
  475. *
  476. * @param url The endpoint URL.
  477. * @param options The HTTP options to send with the request.
  478. *
  479. * @return An `Observable` of the response body as an `ArrayBuffer`.
  480. */
  481. delete(url: string, options: {
  482. headers?: HttpHeaders | Record<string, string | string[]>;
  483. context?: HttpContext;
  484. observe?: 'body';
  485. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  486. reportProgress?: boolean;
  487. responseType: 'arraybuffer';
  488. withCredentials?: boolean;
  489. body?: any | null;
  490. }): Observable<ArrayBuffer>;
  491. /**
  492. * Constructs a `DELETE` request that interprets the body as a `Blob` and returns
  493. * the response as a `Blob`.
  494. *
  495. * @param url The endpoint URL.
  496. * @param options The HTTP options to send with the request.
  497. *
  498. * @return An `Observable` of the response body as a `Blob`.
  499. */
  500. delete(url: string, options: {
  501. headers?: HttpHeaders | Record<string, string | string[]>;
  502. context?: HttpContext;
  503. observe?: 'body';
  504. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  505. reportProgress?: boolean;
  506. responseType: 'blob';
  507. withCredentials?: boolean;
  508. body?: any | null;
  509. }): Observable<Blob>;
  510. /**
  511. * Constructs a `DELETE` request that interprets the body as a text string and returns
  512. * a string.
  513. *
  514. * @param url The endpoint URL.
  515. * @param options The HTTP options to send with the request.
  516. *
  517. * @return An `Observable` of the response, with the response body of type string.
  518. */
  519. delete(url: string, options: {
  520. headers?: HttpHeaders | Record<string, string | string[]>;
  521. context?: HttpContext;
  522. observe?: 'body';
  523. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  524. reportProgress?: boolean;
  525. responseType: 'text';
  526. withCredentials?: boolean;
  527. body?: any | null;
  528. }): Observable<string>;
  529. /**
  530. * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer`
  531. * and returns the full event stream.
  532. *
  533. * @param url The endpoint URL.
  534. * @param options The HTTP options to send with the request.
  535. *
  536. * @return An `Observable` of all `HttpEvent`s for the request,
  537. * with response body as an `ArrayBuffer`.
  538. */
  539. delete(url: string, options: {
  540. headers?: HttpHeaders | Record<string, string | string[]>;
  541. observe: 'events';
  542. context?: HttpContext;
  543. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  544. reportProgress?: boolean;
  545. responseType: 'arraybuffer';
  546. withCredentials?: boolean;
  547. body?: any | null;
  548. }): Observable<HttpEvent<ArrayBuffer>>;
  549. /**
  550. * Constructs a `DELETE` request that interprets the body as a `Blob`
  551. * and returns the full event stream.
  552. *
  553. * @param url The endpoint URL.
  554. * @param options The HTTP options to send with the request.
  555. *
  556. * @return An `Observable` of all the `HttpEvent`s for the request, with the response body as a
  557. * `Blob`.
  558. */
  559. delete(url: string, options: {
  560. headers?: HttpHeaders | Record<string, string | string[]>;
  561. observe: 'events';
  562. context?: HttpContext;
  563. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  564. reportProgress?: boolean;
  565. responseType: 'blob';
  566. withCredentials?: boolean;
  567. body?: any | null;
  568. }): Observable<HttpEvent<Blob>>;
  569. /**
  570. * Constructs a `DELETE` request that interprets the body as a text string
  571. * and returns the full event stream.
  572. *
  573. * @param url The endpoint URL.
  574. * @param options The HTTP options to send with the request.
  575. *
  576. * @return An `Observable` of all `HttpEvent`s for the request, with the response
  577. * body of type string.
  578. */
  579. delete(url: string, options: {
  580. headers?: HttpHeaders | Record<string, string | string[]>;
  581. observe: 'events';
  582. context?: HttpContext;
  583. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  584. reportProgress?: boolean;
  585. responseType: 'text';
  586. withCredentials?: boolean;
  587. body?: any | null;
  588. }): Observable<HttpEvent<string>>;
  589. /**
  590. * Constructs a `DELETE` request that interprets the body as JSON
  591. * and returns the full event stream.
  592. *
  593. * @param url The endpoint URL.
  594. * @param options The HTTP options to send with the request.
  595. *
  596. * @return An `Observable` of all `HttpEvent`s for the request, with response body of
  597. * type `Object`.
  598. */
  599. delete(url: string, options: {
  600. headers?: HttpHeaders | Record<string, string | string[]>;
  601. observe: 'events';
  602. context?: HttpContext;
  603. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  604. reportProgress?: boolean;
  605. responseType?: 'json';
  606. withCredentials?: boolean;
  607. body?: any | null;
  608. }): Observable<HttpEvent<Object>>;
  609. /**
  610. * Constructs a `DELETE`request that interprets the body as JSON
  611. * and returns the full event stream.
  612. *
  613. * @param url The endpoint URL.
  614. * @param options The HTTP options to send with the request.
  615. *
  616. * @return An `Observable` of all the `HttpEvent`s for the request, with a response
  617. * body in the requested type.
  618. */
  619. delete<T>(url: string, options: {
  620. headers?: HttpHeaders | Record<string, string | string[]>;
  621. observe: 'events';
  622. context?: HttpContext;
  623. params?: HttpParams | Record<string, string | number | boolean | (string | number | boolean)[]>;
  624. reportProgress?: boolean;
  625. responseType?: 'json';
  626. withCredentials?: boolean;
  627. body?: any | null;
  628. }): Observable<HttpEvent<T>>;
  629. /**
  630. * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer` and returns
  631. * the full `HttpResponse`.
  632. *
  633. * @param url The endpoint URL.
  634. * @param options The HTTP options to send with the request.
  635. *
  636. * @return An `Observable` of the full `HttpResponse`, with the response body as an `ArrayBuffer`.
  637. */
  638. delete(url: string, options: {
  639. headers?: HttpHeaders | Record<string, string | string[]>;
  640. observe: 'response';
  641. context?: HttpContext;
  642. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  643. reportProgress?: boolean;
  644. responseType: 'arraybuffer';
  645. withCredentials?: boolean;
  646. body?: any | null;
  647. }): Observable<HttpResponse<ArrayBuffer>>;
  648. /**
  649. * Constructs a `DELETE` request that interprets the body as a `Blob` and returns the full
  650. * `HttpResponse`.
  651. *
  652. * @param url The endpoint URL.
  653. * @param options The HTTP options to send with the request.
  654. *
  655. * @return An `Observable` of the `HttpResponse`, with the response body of type `Blob`.
  656. */
  657. delete(url: string, options: {
  658. headers?: HttpHeaders | Record<string, string | string[]>;
  659. observe: 'response';
  660. context?: HttpContext;
  661. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  662. reportProgress?: boolean;
  663. responseType: 'blob';
  664. withCredentials?: boolean;
  665. body?: any | null;
  666. }): Observable<HttpResponse<Blob>>;
  667. /**
  668. * Constructs a `DELETE` request that interprets the body as a text stream and
  669. * returns the full `HttpResponse`.
  670. *
  671. * @param url The endpoint URL.
  672. * @param options The HTTP options to send with the request.
  673. *
  674. * @return An `Observable` of the full `HttpResponse`, with the response body of type string.
  675. */
  676. delete(url: string, options: {
  677. headers?: HttpHeaders | Record<string, string | string[]>;
  678. observe: 'response';
  679. context?: HttpContext;
  680. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  681. reportProgress?: boolean;
  682. responseType: 'text';
  683. withCredentials?: boolean;
  684. body?: any | null;
  685. }): Observable<HttpResponse<string>>;
  686. /**
  687. * Constructs a `DELETE` request the interprets the body as a JavaScript object and returns
  688. * the full `HttpResponse`.
  689. *
  690. * @param url The endpoint URL.
  691. * @param options The HTTP options to send with the request.
  692. *
  693. * @return An `Observable` of the `HttpResponse`, with the response body of type `Object`.
  694. *
  695. */
  696. delete(url: string, options: {
  697. headers?: HttpHeaders | Record<string, string | string[]>;
  698. observe: 'response';
  699. context?: HttpContext;
  700. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  701. reportProgress?: boolean;
  702. responseType?: 'json';
  703. withCredentials?: boolean;
  704. body?: any | null;
  705. }): Observable<HttpResponse<Object>>;
  706. /**
  707. * Constructs a `DELETE` request that interprets the body as JSON
  708. * and returns the full `HttpResponse`.
  709. *
  710. * @param url The endpoint URL.
  711. * @param options The HTTP options to send with the request.
  712. *
  713. * @return An `Observable` of the `HttpResponse`, with the response body of the requested type.
  714. */
  715. delete<T>(url: string, options: {
  716. headers?: HttpHeaders | Record<string, string | string[]>;
  717. observe: 'response';
  718. context?: HttpContext;
  719. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  720. reportProgress?: boolean;
  721. responseType?: 'json';
  722. withCredentials?: boolean;
  723. body?: any | null;
  724. }): Observable<HttpResponse<T>>;
  725. /**
  726. * Constructs a `DELETE` request that interprets the body as JSON and
  727. * returns the response body as an object parsed from JSON.
  728. *
  729. * @param url The endpoint URL.
  730. * @param options The HTTP options to send with the request.
  731. *
  732. * @return An `Observable` of the response, with the response body of type `Object`.
  733. */
  734. delete(url: string, options?: {
  735. headers?: HttpHeaders | Record<string, string | string[]>;
  736. context?: HttpContext;
  737. observe?: 'body';
  738. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  739. reportProgress?: boolean;
  740. responseType?: 'json';
  741. withCredentials?: boolean;
  742. body?: any | null;
  743. }): Observable<Object>;
  744. /**
  745. * Constructs a DELETE request that interprets the body as JSON and returns
  746. * the response in a given type.
  747. *
  748. * @param url The endpoint URL.
  749. * @param options The HTTP options to send with the request.
  750. *
  751. * @return An `Observable` of the `HttpResponse`, with response body in the requested type.
  752. */
  753. delete<T>(url: string, options?: {
  754. headers?: HttpHeaders | Record<string, string | string[]>;
  755. context?: HttpContext;
  756. observe?: 'body';
  757. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  758. reportProgress?: boolean;
  759. responseType?: 'json';
  760. withCredentials?: boolean;
  761. body?: any | null;
  762. }): Observable<T>;
  763. /**
  764. * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and returns the
  765. * response in an `ArrayBuffer`.
  766. *
  767. * @param url The endpoint URL.
  768. * @param options The HTTP options to send with the request.
  769. *
  770. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  771. */
  772. get(url: string, options: {
  773. headers?: HttpHeaders | Record<string, string | string[]>;
  774. context?: HttpContext;
  775. observe?: 'body';
  776. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  777. reportProgress?: boolean;
  778. responseType: 'arraybuffer';
  779. withCredentials?: boolean;
  780. transferCache?: {
  781. includeHeaders?: string[];
  782. } | boolean;
  783. }): Observable<ArrayBuffer>;
  784. /**
  785. * Constructs a `GET` request that interprets the body as a `Blob`
  786. * and returns the response as a `Blob`.
  787. *
  788. * @param url The endpoint URL.
  789. * @param options The HTTP options to send with the request.
  790. *
  791. * @return An `Observable` of the response, with the response body as a `Blob`.
  792. */
  793. get(url: string, options: {
  794. headers?: HttpHeaders | Record<string, string | string[]>;
  795. context?: HttpContext;
  796. observe?: 'body';
  797. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  798. reportProgress?: boolean;
  799. responseType: 'blob';
  800. withCredentials?: boolean;
  801. transferCache?: {
  802. includeHeaders?: string[];
  803. } | boolean;
  804. }): Observable<Blob>;
  805. /**
  806. * Constructs a `GET` request that interprets the body as a text string
  807. * and returns the response as a string value.
  808. *
  809. * @param url The endpoint URL.
  810. * @param options The HTTP options to send with the request.
  811. *
  812. * @return An `Observable` of the response, with the response body of type string.
  813. */
  814. get(url: string, options: {
  815. headers?: HttpHeaders | Record<string, string | string[]>;
  816. context?: HttpContext;
  817. observe?: 'body';
  818. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  819. reportProgress?: boolean;
  820. responseType: 'text';
  821. withCredentials?: boolean;
  822. transferCache?: {
  823. includeHeaders?: string[];
  824. } | boolean;
  825. }): Observable<string>;
  826. /**
  827. * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and returns
  828. * the full event stream.
  829. *
  830. * @param url The endpoint URL.
  831. * @param options The HTTP options to send with the request.
  832. *
  833. * @return An `Observable` of all `HttpEvent`s for the request, with the response
  834. * body as an `ArrayBuffer`.
  835. */
  836. get(url: string, options: {
  837. headers?: HttpHeaders | Record<string, string | string[]>;
  838. observe: 'events';
  839. context?: HttpContext;
  840. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  841. reportProgress?: boolean;
  842. responseType: 'arraybuffer';
  843. withCredentials?: boolean;
  844. transferCache?: {
  845. includeHeaders?: string[];
  846. } | boolean;
  847. }): Observable<HttpEvent<ArrayBuffer>>;
  848. /**
  849. * Constructs a `GET` request that interprets the body as a `Blob` and
  850. * returns the full event stream.
  851. *
  852. * @param url The endpoint URL.
  853. * @param options The HTTP options to send with the request.
  854. *
  855. * @return An `Observable` of the response, with the response body as a `Blob`.
  856. */
  857. get(url: string, options: {
  858. headers?: HttpHeaders | Record<string, string | string[]>;
  859. observe: 'events';
  860. context?: HttpContext;
  861. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  862. reportProgress?: boolean;
  863. responseType: 'blob';
  864. withCredentials?: boolean;
  865. transferCache?: {
  866. includeHeaders?: string[];
  867. } | boolean;
  868. }): Observable<HttpEvent<Blob>>;
  869. /**
  870. * Constructs a `GET` request that interprets the body as a text string and returns
  871. * the full event stream.
  872. *
  873. * @param url The endpoint URL.
  874. * @param options The HTTP options to send with the request.
  875. *
  876. * @return An `Observable` of the response, with the response body of type string.
  877. */
  878. get(url: string, options: {
  879. headers?: HttpHeaders | Record<string, string | string[]>;
  880. observe: 'events';
  881. context?: HttpContext;
  882. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  883. reportProgress?: boolean;
  884. responseType: 'text';
  885. withCredentials?: boolean;
  886. transferCache?: {
  887. includeHeaders?: string[];
  888. } | boolean;
  889. }): Observable<HttpEvent<string>>;
  890. /**
  891. * Constructs a `GET` request that interprets the body as JSON
  892. * and returns the full event stream.
  893. *
  894. * @param url The endpoint URL.
  895. * @param options The HTTP options to send with the request.
  896. *
  897. * @return An `Observable` of the response, with the response body of type `Object`.
  898. */
  899. get(url: string, options: {
  900. headers?: HttpHeaders | Record<string, string | string[]>;
  901. observe: 'events';
  902. context?: HttpContext;
  903. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  904. reportProgress?: boolean;
  905. responseType?: 'json';
  906. withCredentials?: boolean;
  907. transferCache?: {
  908. includeHeaders?: string[];
  909. } | boolean;
  910. }): Observable<HttpEvent<Object>>;
  911. /**
  912. * Constructs a `GET` request that interprets the body as JSON and returns the full
  913. * event stream.
  914. *
  915. * @param url The endpoint URL.
  916. * @param options The HTTP options to send with the request.
  917. *
  918. * @return An `Observable` of the response, with a response body in the requested type.
  919. */
  920. get<T>(url: string, options: {
  921. headers?: HttpHeaders | Record<string, string | string[]>;
  922. observe: 'events';
  923. context?: HttpContext;
  924. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  925. reportProgress?: boolean;
  926. responseType?: 'json';
  927. withCredentials?: boolean;
  928. transferCache?: {
  929. includeHeaders?: string[];
  930. } | boolean;
  931. }): Observable<HttpEvent<T>>;
  932. /**
  933. * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and
  934. * returns the full `HttpResponse`.
  935. *
  936. * @param url The endpoint URL.
  937. * @param options The HTTP options to send with the request.
  938. *
  939. * @return An `Observable` of the `HttpResponse` for the request,
  940. * with the response body as an `ArrayBuffer`.
  941. */
  942. get(url: string, options: {
  943. headers?: HttpHeaders | Record<string, string | string[]>;
  944. observe: 'response';
  945. context?: HttpContext;
  946. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  947. reportProgress?: boolean;
  948. responseType: 'arraybuffer';
  949. withCredentials?: boolean;
  950. transferCache?: {
  951. includeHeaders?: string[];
  952. } | boolean;
  953. }): Observable<HttpResponse<ArrayBuffer>>;
  954. /**
  955. * Constructs a `GET` request that interprets the body as a `Blob` and
  956. * returns the full `HttpResponse`.
  957. *
  958. * @param url The endpoint URL.
  959. * @param options The HTTP options to send with the request.
  960. *
  961. * @return An `Observable` of the `HttpResponse` for the request,
  962. * with the response body as a `Blob`.
  963. */
  964. get(url: string, options: {
  965. headers?: HttpHeaders | Record<string, string | string[]>;
  966. observe: 'response';
  967. context?: HttpContext;
  968. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  969. reportProgress?: boolean;
  970. responseType: 'blob';
  971. withCredentials?: boolean;
  972. transferCache?: {
  973. includeHeaders?: string[];
  974. } | boolean;
  975. }): Observable<HttpResponse<Blob>>;
  976. /**
  977. * Constructs a `GET` request that interprets the body as a text stream and
  978. * returns the full `HttpResponse`.
  979. *
  980. * @param url The endpoint URL.
  981. * @param options The HTTP options to send with the request.
  982. *
  983. * @return An `Observable` of the `HttpResponse` for the request,
  984. * with the response body of type string.
  985. */
  986. get(url: string, options: {
  987. headers?: HttpHeaders | Record<string, string | string[]>;
  988. observe: 'response';
  989. context?: HttpContext;
  990. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  991. reportProgress?: boolean;
  992. responseType: 'text';
  993. withCredentials?: boolean;
  994. transferCache?: {
  995. includeHeaders?: string[];
  996. } | boolean;
  997. }): Observable<HttpResponse<string>>;
  998. /**
  999. * Constructs a `GET` request that interprets the body as JSON and
  1000. * returns the full `HttpResponse`.
  1001. *
  1002. * @param url The endpoint URL.
  1003. * @param options The HTTP options to send with the request.
  1004. *
  1005. * @return An `Observable` of the full `HttpResponse`,
  1006. * with the response body of type `Object`.
  1007. */
  1008. get(url: string, options: {
  1009. headers?: HttpHeaders | Record<string, string | string[]>;
  1010. observe: 'response';
  1011. context?: HttpContext;
  1012. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1013. reportProgress?: boolean;
  1014. responseType?: 'json';
  1015. withCredentials?: boolean;
  1016. transferCache?: {
  1017. includeHeaders?: string[];
  1018. } | boolean;
  1019. }): Observable<HttpResponse<Object>>;
  1020. /**
  1021. * Constructs a `GET` request that interprets the body as JSON and
  1022. * returns the full `HttpResponse`.
  1023. *
  1024. * @param url The endpoint URL.
  1025. * @param options The HTTP options to send with the request.
  1026. *
  1027. * @return An `Observable` of the full `HttpResponse` for the request,
  1028. * with a response body in the requested type.
  1029. */
  1030. get<T>(url: string, options: {
  1031. headers?: HttpHeaders | Record<string, string | string[]>;
  1032. observe: 'response';
  1033. context?: HttpContext;
  1034. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1035. reportProgress?: boolean;
  1036. responseType?: 'json';
  1037. withCredentials?: boolean;
  1038. transferCache?: {
  1039. includeHeaders?: string[];
  1040. } | boolean;
  1041. }): Observable<HttpResponse<T>>;
  1042. /**
  1043. * Constructs a `GET` request that interprets the body as JSON and
  1044. * returns the response body as an object parsed from JSON.
  1045. *
  1046. * @param url The endpoint URL.
  1047. * @param options The HTTP options to send with the request.
  1048. *
  1049. *
  1050. * @return An `Observable` of the response body as a JavaScript object.
  1051. */
  1052. get(url: string, options?: {
  1053. headers?: HttpHeaders | Record<string, string | string[]>;
  1054. context?: HttpContext;
  1055. observe?: 'body';
  1056. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1057. reportProgress?: boolean;
  1058. responseType?: 'json';
  1059. withCredentials?: boolean;
  1060. transferCache?: {
  1061. includeHeaders?: string[];
  1062. } | boolean;
  1063. }): Observable<Object>;
  1064. /**
  1065. * Constructs a `GET` request that interprets the body as JSON and returns
  1066. * the response body in a given type.
  1067. *
  1068. * @param url The endpoint URL.
  1069. * @param options The HTTP options to send with the request.
  1070. *
  1071. * @return An `Observable` of the `HttpResponse`, with a response body in the requested type.
  1072. */
  1073. get<T>(url: string, options?: {
  1074. headers?: HttpHeaders | Record<string, string | string[]>;
  1075. context?: HttpContext;
  1076. observe?: 'body';
  1077. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1078. reportProgress?: boolean;
  1079. responseType?: 'json';
  1080. withCredentials?: boolean;
  1081. transferCache?: {
  1082. includeHeaders?: string[];
  1083. } | boolean;
  1084. }): Observable<T>;
  1085. /**
  1086. * Constructs a `HEAD` request that interprets the body as an `ArrayBuffer` and
  1087. * returns the response as an `ArrayBuffer`.
  1088. *
  1089. * @param url The endpoint URL.
  1090. * @param options The HTTP options to send with the request.
  1091. *
  1092. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  1093. */
  1094. head(url: string, options: {
  1095. headers?: HttpHeaders | Record<string, string | string[]>;
  1096. context?: HttpContext;
  1097. observe?: 'body';
  1098. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1099. reportProgress?: boolean;
  1100. responseType: 'arraybuffer';
  1101. withCredentials?: boolean;
  1102. transferCache?: {
  1103. includeHeaders?: string[];
  1104. } | boolean;
  1105. }): Observable<ArrayBuffer>;
  1106. /**
  1107. * Constructs a `HEAD` request that interprets the body as a `Blob` and returns
  1108. * the response as a `Blob`.
  1109. *
  1110. * @param url The endpoint URL.
  1111. * @param options The HTTP options to send with the request.
  1112. *
  1113. * @return An `Observable` of the response, with the response body as a `Blob`.
  1114. */
  1115. head(url: string, options: {
  1116. headers?: HttpHeaders | Record<string, string | string[]>;
  1117. context?: HttpContext;
  1118. observe?: 'body';
  1119. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1120. reportProgress?: boolean;
  1121. responseType: 'blob';
  1122. withCredentials?: boolean;
  1123. transferCache?: {
  1124. includeHeaders?: string[];
  1125. } | boolean;
  1126. }): Observable<Blob>;
  1127. /**
  1128. * Constructs a `HEAD` request that interprets the body as a text string and returns the response
  1129. * as a string value.
  1130. *
  1131. * @param url The endpoint URL.
  1132. * @param options The HTTP options to send with the request.
  1133. *
  1134. * @return An `Observable` of the response, with the response body of type string.
  1135. */
  1136. head(url: string, options: {
  1137. headers?: HttpHeaders | Record<string, string | string[]>;
  1138. context?: HttpContext;
  1139. observe?: 'body';
  1140. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1141. reportProgress?: boolean;
  1142. responseType: 'text';
  1143. withCredentials?: boolean;
  1144. transferCache?: {
  1145. includeHeaders?: string[];
  1146. } | boolean;
  1147. }): Observable<string>;
  1148. /**
  1149. * Constructs a `HEAD` request that interprets the body as an `ArrayBuffer`
  1150. * and returns the full event stream.
  1151. *
  1152. * @param url The endpoint URL.
  1153. * @param options The HTTP options to send with the request.
  1154. *
  1155. * @return An `Observable` of all `HttpEvent`s for the request,
  1156. * with the response body as an `ArrayBuffer`.
  1157. */
  1158. head(url: string, options: {
  1159. headers?: HttpHeaders | Record<string, string | string[]>;
  1160. observe: 'events';
  1161. context?: HttpContext;
  1162. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1163. reportProgress?: boolean;
  1164. responseType: 'arraybuffer';
  1165. withCredentials?: boolean;
  1166. transferCache?: {
  1167. includeHeaders?: string[];
  1168. } | boolean;
  1169. }): Observable<HttpEvent<ArrayBuffer>>;
  1170. /**
  1171. * Constructs a `HEAD` request that interprets the body as a `Blob` and
  1172. * returns the full event stream.
  1173. *
  1174. * @param url The endpoint URL.
  1175. * @param options The HTTP options to send with the request.
  1176. *
  1177. * @return An `Observable` of all `HttpEvent`s for the request,
  1178. * with the response body as a `Blob`.
  1179. */
  1180. head(url: string, options: {
  1181. headers?: HttpHeaders | Record<string, string | string[]>;
  1182. observe: 'events';
  1183. context?: HttpContext;
  1184. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1185. reportProgress?: boolean;
  1186. responseType: 'blob';
  1187. withCredentials?: boolean;
  1188. transferCache?: {
  1189. includeHeaders?: string[];
  1190. } | boolean;
  1191. }): Observable<HttpEvent<Blob>>;
  1192. /**
  1193. * Constructs a `HEAD` request that interprets the body as a text string
  1194. * and returns the full event stream.
  1195. *
  1196. * @param url The endpoint URL.
  1197. * @param options The HTTP options to send with the request.
  1198. *
  1199. * @return An `Observable` of all `HttpEvent`s for the request, with the response body of type
  1200. * string.
  1201. */
  1202. head(url: string, options: {
  1203. headers?: HttpHeaders | Record<string, string | string[]>;
  1204. observe: 'events';
  1205. context?: HttpContext;
  1206. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1207. reportProgress?: boolean;
  1208. responseType: 'text';
  1209. withCredentials?: boolean;
  1210. transferCache?: {
  1211. includeHeaders?: string[];
  1212. } | boolean;
  1213. }): Observable<HttpEvent<string>>;
  1214. /**
  1215. * Constructs a `HEAD` request that interprets the body as JSON
  1216. * and returns the full HTTP event stream.
  1217. *
  1218. * @param url The endpoint URL.
  1219. * @param options The HTTP options to send with the request.
  1220. *
  1221. * @return An `Observable` of all `HttpEvent`s for the request, with a response body of
  1222. * type `Object`.
  1223. */
  1224. head(url: string, options: {
  1225. headers?: HttpHeaders | Record<string, string | string[]>;
  1226. observe: 'events';
  1227. context?: HttpContext;
  1228. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1229. reportProgress?: boolean;
  1230. responseType?: 'json';
  1231. withCredentials?: boolean;
  1232. transferCache?: {
  1233. includeHeaders?: string[];
  1234. } | boolean;
  1235. }): Observable<HttpEvent<Object>>;
  1236. /**
  1237. * Constructs a `HEAD` request that interprets the body as JSON and
  1238. * returns the full event stream.
  1239. *
  1240. * @return An `Observable` of all the `HttpEvent`s for the request,
  1241. * with a response body in the requested type.
  1242. *
  1243. * @param url The endpoint URL.
  1244. * @param options The HTTP options to send with the request.
  1245. */
  1246. head<T>(url: string, options: {
  1247. headers?: HttpHeaders | Record<string, string | string[]>;
  1248. observe: 'events';
  1249. context?: HttpContext;
  1250. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1251. reportProgress?: boolean;
  1252. responseType?: 'json';
  1253. withCredentials?: boolean;
  1254. transferCache?: {
  1255. includeHeaders?: string[];
  1256. } | boolean;
  1257. }): Observable<HttpEvent<T>>;
  1258. /**
  1259. * Constructs a `HEAD` request that interprets the body as an `ArrayBuffer`
  1260. * and returns the full HTTP response.
  1261. *
  1262. * @param url The endpoint URL.
  1263. * @param options The HTTP options to send with the request.
  1264. *
  1265. * @return An `Observable` of the `HttpResponse` for the request,
  1266. * with the response body as an `ArrayBuffer`.
  1267. */
  1268. head(url: string, options: {
  1269. headers?: HttpHeaders | Record<string, string | string[]>;
  1270. observe: 'response';
  1271. context?: HttpContext;
  1272. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1273. reportProgress?: boolean;
  1274. responseType: 'arraybuffer';
  1275. withCredentials?: boolean;
  1276. transferCache?: {
  1277. includeHeaders?: string[];
  1278. } | boolean;
  1279. }): Observable<HttpResponse<ArrayBuffer>>;
  1280. /**
  1281. * Constructs a `HEAD` request that interprets the body as a `Blob` and returns
  1282. * the full `HttpResponse`.
  1283. *
  1284. * @param url The endpoint URL.
  1285. * @param options The HTTP options to send with the request.
  1286. *
  1287. * @return An `Observable` of the `HttpResponse` for the request,
  1288. * with the response body as a blob.
  1289. */
  1290. head(url: string, options: {
  1291. headers?: HttpHeaders | Record<string, string | string[]>;
  1292. observe: 'response';
  1293. context?: HttpContext;
  1294. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1295. reportProgress?: boolean;
  1296. responseType: 'blob';
  1297. withCredentials?: boolean;
  1298. transferCache?: {
  1299. includeHeaders?: string[];
  1300. } | boolean;
  1301. }): Observable<HttpResponse<Blob>>;
  1302. /**
  1303. * Constructs a `HEAD` request that interprets the body as text stream
  1304. * and returns the full `HttpResponse`.
  1305. *
  1306. * @param url The endpoint URL.
  1307. * @param options The HTTP options to send with the request.
  1308. *
  1309. * @return An `Observable` of the `HttpResponse` for the request,
  1310. * with the response body of type string.
  1311. */
  1312. head(url: string, options: {
  1313. headers?: HttpHeaders | Record<string, string | string[]>;
  1314. observe: 'response';
  1315. context?: HttpContext;
  1316. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1317. reportProgress?: boolean;
  1318. responseType: 'text';
  1319. withCredentials?: boolean;
  1320. transferCache?: {
  1321. includeHeaders?: string[];
  1322. } | boolean;
  1323. }): Observable<HttpResponse<string>>;
  1324. /**
  1325. * Constructs a `HEAD` request that interprets the body as JSON and
  1326. * returns the full `HttpResponse`.
  1327. *
  1328. * @param url The endpoint URL.
  1329. * @param options The HTTP options to send with the request.
  1330. *
  1331. * @return An `Observable` of the `HttpResponse` for the request,
  1332. * with the response body of type `Object`.
  1333. */
  1334. head(url: string, options: {
  1335. headers?: HttpHeaders | Record<string, string | string[]>;
  1336. observe: 'response';
  1337. context?: HttpContext;
  1338. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1339. reportProgress?: boolean;
  1340. responseType?: 'json';
  1341. withCredentials?: boolean;
  1342. transferCache?: {
  1343. includeHeaders?: string[];
  1344. } | boolean;
  1345. }): Observable<HttpResponse<Object>>;
  1346. /**
  1347. * Constructs a `HEAD` request that interprets the body as JSON
  1348. * and returns the full `HttpResponse`.
  1349. *
  1350. * @param url The endpoint URL.
  1351. * @param options The HTTP options to send with the request.
  1352. *
  1353. * @return An `Observable` of the `HttpResponse` for the request,
  1354. * with a response body of the requested type.
  1355. */
  1356. head<T>(url: string, options: {
  1357. headers?: HttpHeaders | Record<string, string | string[]>;
  1358. observe: 'response';
  1359. context?: HttpContext;
  1360. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1361. reportProgress?: boolean;
  1362. responseType?: 'json';
  1363. withCredentials?: boolean;
  1364. transferCache?: {
  1365. includeHeaders?: string[];
  1366. } | boolean;
  1367. }): Observable<HttpResponse<T>>;
  1368. /**
  1369. * Constructs a `HEAD` request that interprets the body as JSON and
  1370. * returns the response body as an object parsed from JSON.
  1371. *
  1372. * @param url The endpoint URL.
  1373. * @param options The HTTP options to send with the request.
  1374. *
  1375. * @return An `Observable` of the response, with the response body as an object parsed from JSON.
  1376. */
  1377. head(url: string, options?: {
  1378. headers?: HttpHeaders | Record<string, string | string[]>;
  1379. context?: HttpContext;
  1380. observe?: 'body';
  1381. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1382. reportProgress?: boolean;
  1383. responseType?: 'json';
  1384. withCredentials?: boolean;
  1385. transferCache?: {
  1386. includeHeaders?: string[];
  1387. } | boolean;
  1388. }): Observable<Object>;
  1389. /**
  1390. * Constructs a `HEAD` request that interprets the body as JSON and returns
  1391. * the response in a given type.
  1392. *
  1393. * @param url The endpoint URL.
  1394. * @param options The HTTP options to send with the request.
  1395. *
  1396. * @return An `Observable` of the `HttpResponse` for the request,
  1397. * with a response body of the given type.
  1398. */
  1399. head<T>(url: string, options?: {
  1400. headers?: HttpHeaders | Record<string, string | string[]>;
  1401. context?: HttpContext;
  1402. observe?: 'body';
  1403. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1404. reportProgress?: boolean;
  1405. responseType?: 'json';
  1406. withCredentials?: boolean;
  1407. transferCache?: {
  1408. includeHeaders?: string[];
  1409. } | boolean;
  1410. }): Observable<T>;
  1411. /**
  1412. * Constructs a `JSONP` request for the given URL and name of the callback parameter.
  1413. *
  1414. * @param url The resource URL.
  1415. * @param callbackParam The callback function name.
  1416. *
  1417. * @return An `Observable` of the response object, with response body as an object.
  1418. */
  1419. jsonp(url: string, callbackParam: string): Observable<Object>;
  1420. /**
  1421. * Constructs a `JSONP` request for the given URL and name of the callback parameter.
  1422. *
  1423. * @param url The resource URL.
  1424. * @param callbackParam The callback function name.
  1425. *
  1426. * You must install a suitable interceptor, such as one provided by `HttpClientJsonpModule`.
  1427. * If no such interceptor is reached,
  1428. * then the `JSONP` request can be rejected by the configured backend.
  1429. *
  1430. * @return An `Observable` of the response object, with response body in the requested type.
  1431. */
  1432. jsonp<T>(url: string, callbackParam: string): Observable<T>;
  1433. /**
  1434. * Constructs an `OPTIONS` request that interprets the body as an
  1435. * `ArrayBuffer` and returns the response as an `ArrayBuffer`.
  1436. *
  1437. * @param url The endpoint URL.
  1438. * @param options HTTP options.
  1439. *
  1440. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  1441. */
  1442. options(url: string, options: {
  1443. headers?: HttpHeaders | Record<string, string | string[]>;
  1444. context?: HttpContext;
  1445. observe?: 'body';
  1446. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1447. reportProgress?: boolean;
  1448. responseType: 'arraybuffer';
  1449. withCredentials?: boolean;
  1450. }): Observable<ArrayBuffer>;
  1451. /**
  1452. * Constructs an `OPTIONS` request that interprets the body as a `Blob` and returns
  1453. * the response as a `Blob`.
  1454. *
  1455. * @param url The endpoint URL.
  1456. * @param options HTTP options.
  1457. *
  1458. * @return An `Observable` of the response, with the response body as a `Blob`.
  1459. */
  1460. options(url: string, options: {
  1461. headers?: HttpHeaders | Record<string, string | string[]>;
  1462. context?: HttpContext;
  1463. observe?: 'body';
  1464. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1465. reportProgress?: boolean;
  1466. responseType: 'blob';
  1467. withCredentials?: boolean;
  1468. }): Observable<Blob>;
  1469. /**
  1470. * Constructs an `OPTIONS` request that interprets the body as a text string and
  1471. * returns a string value.
  1472. *
  1473. * @param url The endpoint URL.
  1474. * @param options HTTP options.
  1475. *
  1476. * @return An `Observable` of the response, with the response body of type string.
  1477. */
  1478. options(url: string, options: {
  1479. headers?: HttpHeaders | Record<string, string | string[]>;
  1480. context?: HttpContext;
  1481. observe?: 'body';
  1482. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1483. reportProgress?: boolean;
  1484. responseType: 'text';
  1485. withCredentials?: boolean;
  1486. }): Observable<string>;
  1487. /**
  1488. * Constructs an `OPTIONS` request that interprets the body as an `ArrayBuffer`
  1489. * and returns the full event stream.
  1490. *
  1491. * @param url The endpoint URL.
  1492. * @param options HTTP options.
  1493. *
  1494. * @return An `Observable` of all `HttpEvent`s for the request,
  1495. * with the response body as an `ArrayBuffer`.
  1496. */
  1497. options(url: string, options: {
  1498. headers?: HttpHeaders | Record<string, string | string[]>;
  1499. observe: 'events';
  1500. context?: HttpContext;
  1501. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1502. reportProgress?: boolean;
  1503. responseType: 'arraybuffer';
  1504. withCredentials?: boolean;
  1505. }): Observable<HttpEvent<ArrayBuffer>>;
  1506. /**
  1507. * Constructs an `OPTIONS` request that interprets the body as a `Blob` and
  1508. * returns the full event stream.
  1509. *
  1510. * @param url The endpoint URL.
  1511. * @param options HTTP options.
  1512. *
  1513. * @return An `Observable` of all `HttpEvent`s for the request,
  1514. * with the response body as a `Blob`.
  1515. */
  1516. options(url: string, options: {
  1517. headers?: HttpHeaders | Record<string, string | string[]>;
  1518. observe: 'events';
  1519. context?: HttpContext;
  1520. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1521. reportProgress?: boolean;
  1522. responseType: 'blob';
  1523. withCredentials?: boolean;
  1524. }): Observable<HttpEvent<Blob>>;
  1525. /**
  1526. * Constructs an `OPTIONS` request that interprets the body as a text string
  1527. * and returns the full event stream.
  1528. *
  1529. * @param url The endpoint URL.
  1530. * @param options HTTP options.
  1531. *
  1532. * @return An `Observable` of all the `HttpEvent`s for the request,
  1533. * with the response body of type string.
  1534. */
  1535. options(url: string, options: {
  1536. headers?: HttpHeaders | Record<string, string | string[]>;
  1537. observe: 'events';
  1538. context?: HttpContext;
  1539. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1540. reportProgress?: boolean;
  1541. responseType: 'text';
  1542. withCredentials?: boolean;
  1543. }): Observable<HttpEvent<string>>;
  1544. /**
  1545. * Constructs an `OPTIONS` request that interprets the body as JSON
  1546. * and returns the full event stream.
  1547. *
  1548. * @param url The endpoint URL.
  1549. * @param options HTTP options.
  1550. *
  1551. * @return An `Observable` of all the `HttpEvent`s for the request with the response
  1552. * body of type `Object`.
  1553. */
  1554. options(url: string, options: {
  1555. headers?: HttpHeaders | Record<string, string | string[]>;
  1556. observe: 'events';
  1557. context?: HttpContext;
  1558. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1559. reportProgress?: boolean;
  1560. responseType?: 'json';
  1561. withCredentials?: boolean;
  1562. }): Observable<HttpEvent<Object>>;
  1563. /**
  1564. * Constructs an `OPTIONS` request that interprets the body as JSON and
  1565. * returns the full event stream.
  1566. *
  1567. * @param url The endpoint URL.
  1568. * @param options HTTP options.
  1569. *
  1570. * @return An `Observable` of all the `HttpEvent`s for the request,
  1571. * with a response body in the requested type.
  1572. */
  1573. options<T>(url: string, options: {
  1574. headers?: HttpHeaders | Record<string, string | string[]>;
  1575. observe: 'events';
  1576. context?: HttpContext;
  1577. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1578. reportProgress?: boolean;
  1579. responseType?: 'json';
  1580. withCredentials?: boolean;
  1581. }): Observable<HttpEvent<T>>;
  1582. /**
  1583. * Constructs an `OPTIONS` request that interprets the body as an `ArrayBuffer`
  1584. * and returns the full HTTP response.
  1585. *
  1586. * @param url The endpoint URL.
  1587. * @param options HTTP options.
  1588. *
  1589. * @return An `Observable` of the `HttpResponse` for the request,
  1590. * with the response body as an `ArrayBuffer`.
  1591. */
  1592. options(url: string, options: {
  1593. headers?: HttpHeaders | Record<string, string | string[]>;
  1594. observe: 'response';
  1595. context?: HttpContext;
  1596. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1597. reportProgress?: boolean;
  1598. responseType: 'arraybuffer';
  1599. withCredentials?: boolean;
  1600. }): Observable<HttpResponse<ArrayBuffer>>;
  1601. /**
  1602. * Constructs an `OPTIONS` request that interprets the body as a `Blob`
  1603. * and returns the full `HttpResponse`.
  1604. *
  1605. * @param url The endpoint URL.
  1606. * @param options HTTP options.
  1607. *
  1608. * @return An `Observable` of the `HttpResponse` for the request,
  1609. * with the response body as a `Blob`.
  1610. */
  1611. options(url: string, options: {
  1612. headers?: HttpHeaders | Record<string, string | string[]>;
  1613. observe: 'response';
  1614. context?: HttpContext;
  1615. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1616. reportProgress?: boolean;
  1617. responseType: 'blob';
  1618. withCredentials?: boolean;
  1619. }): Observable<HttpResponse<Blob>>;
  1620. /**
  1621. * Constructs an `OPTIONS` request that interprets the body as text stream
  1622. * and returns the full `HttpResponse`.
  1623. *
  1624. * @param url The endpoint URL.
  1625. * @param options HTTP options.
  1626. *
  1627. * @return An `Observable` of the `HttpResponse` for the request,
  1628. * with the response body of type string.
  1629. */
  1630. options(url: string, options: {
  1631. headers?: HttpHeaders | Record<string, string | string[]>;
  1632. observe: 'response';
  1633. context?: HttpContext;
  1634. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1635. reportProgress?: boolean;
  1636. responseType: 'text';
  1637. withCredentials?: boolean;
  1638. }): Observable<HttpResponse<string>>;
  1639. /**
  1640. * Constructs an `OPTIONS` request that interprets the body as JSON
  1641. * and returns the full `HttpResponse`.
  1642. *
  1643. * @param url The endpoint URL.
  1644. * @param options HTTP options.
  1645. *
  1646. * @return An `Observable` of the `HttpResponse` for the request,
  1647. * with the response body of type `Object`.
  1648. */
  1649. options(url: string, options: {
  1650. headers?: HttpHeaders | Record<string, string | string[]>;
  1651. observe: 'response';
  1652. context?: HttpContext;
  1653. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1654. reportProgress?: boolean;
  1655. responseType?: 'json';
  1656. withCredentials?: boolean;
  1657. }): Observable<HttpResponse<Object>>;
  1658. /**
  1659. * Constructs an `OPTIONS` request that interprets the body as JSON and
  1660. * returns the full `HttpResponse`.
  1661. *
  1662. * @param url The endpoint URL.
  1663. * @param options HTTP options.
  1664. *
  1665. * @return An `Observable` of the `HttpResponse` for the request,
  1666. * with a response body in the requested type.
  1667. */
  1668. options<T>(url: string, options: {
  1669. headers?: HttpHeaders | Record<string, string | string[]>;
  1670. observe: 'response';
  1671. context?: HttpContext;
  1672. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1673. reportProgress?: boolean;
  1674. responseType?: 'json';
  1675. withCredentials?: boolean;
  1676. }): Observable<HttpResponse<T>>;
  1677. /**
  1678. * Constructs an `OPTIONS` request that interprets the body as JSON and returns the
  1679. * response body as an object parsed from JSON.
  1680. *
  1681. * @param url The endpoint URL.
  1682. * @param options HTTP options.
  1683. *
  1684. * @return An `Observable` of the response, with the response body as an object parsed from JSON.
  1685. */
  1686. options(url: string, options?: {
  1687. headers?: HttpHeaders | Record<string, string | string[]>;
  1688. context?: HttpContext;
  1689. observe?: 'body';
  1690. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1691. reportProgress?: boolean;
  1692. responseType?: 'json';
  1693. withCredentials?: boolean;
  1694. }): Observable<Object>;
  1695. /**
  1696. * Constructs an `OPTIONS` request that interprets the body as JSON and returns the
  1697. * response in a given type.
  1698. *
  1699. * @param url The endpoint URL.
  1700. * @param options HTTP options.
  1701. *
  1702. * @return An `Observable` of the `HttpResponse`, with a response body of the given type.
  1703. */
  1704. options<T>(url: string, options?: {
  1705. headers?: HttpHeaders | Record<string, string | string[]>;
  1706. context?: HttpContext;
  1707. observe?: 'body';
  1708. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1709. reportProgress?: boolean;
  1710. responseType?: 'json';
  1711. withCredentials?: boolean;
  1712. }): Observable<T>;
  1713. /**
  1714. * Constructs a `PATCH` request that interprets the body as an `ArrayBuffer` and returns
  1715. * the response as an `ArrayBuffer`.
  1716. *
  1717. * @param url The endpoint URL.
  1718. * @param body The resources to edit.
  1719. * @param options HTTP options.
  1720. *
  1721. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  1722. */
  1723. patch(url: string, body: any | null, options: {
  1724. headers?: HttpHeaders | Record<string, string | string[]>;
  1725. context?: HttpContext;
  1726. observe?: 'body';
  1727. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1728. reportProgress?: boolean;
  1729. responseType: 'arraybuffer';
  1730. withCredentials?: boolean;
  1731. }): Observable<ArrayBuffer>;
  1732. /**
  1733. * Constructs a `PATCH` request that interprets the body as a `Blob` and returns the response
  1734. * as a `Blob`.
  1735. *
  1736. * @param url The endpoint URL.
  1737. * @param body The resources to edit.
  1738. * @param options HTTP options.
  1739. *
  1740. * @return An `Observable` of the response, with the response body as a `Blob`.
  1741. */
  1742. patch(url: string, body: any | null, options: {
  1743. headers?: HttpHeaders | Record<string, string | string[]>;
  1744. context?: HttpContext;
  1745. observe?: 'body';
  1746. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1747. reportProgress?: boolean;
  1748. responseType: 'blob';
  1749. withCredentials?: boolean;
  1750. }): Observable<Blob>;
  1751. /**
  1752. * Constructs a `PATCH` request that interprets the body as a text string and
  1753. * returns the response as a string value.
  1754. *
  1755. * @param url The endpoint URL.
  1756. * @param body The resources to edit.
  1757. * @param options HTTP options.
  1758. *
  1759. * @return An `Observable` of the response, with a response body of type string.
  1760. */
  1761. patch(url: string, body: any | null, options: {
  1762. headers?: HttpHeaders | Record<string, string | string[]>;
  1763. context?: HttpContext;
  1764. observe?: 'body';
  1765. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1766. reportProgress?: boolean;
  1767. responseType: 'text';
  1768. withCredentials?: boolean;
  1769. }): Observable<string>;
  1770. /**
  1771. * Constructs a `PATCH` request that interprets the body as an `ArrayBuffer` and
  1772. * returns the full event stream.
  1773. *
  1774. * @param url The endpoint URL.
  1775. * @param body The resources to edit.
  1776. * @param options HTTP options.
  1777. *
  1778. * @return An `Observable` of all the `HttpEvent`s for the request,
  1779. * with the response body as an `ArrayBuffer`.
  1780. */
  1781. patch(url: string, body: any | null, options: {
  1782. headers?: HttpHeaders | Record<string, string | string[]>;
  1783. observe: 'events';
  1784. context?: HttpContext;
  1785. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1786. reportProgress?: boolean;
  1787. responseType: 'arraybuffer';
  1788. withCredentials?: boolean;
  1789. }): Observable<HttpEvent<ArrayBuffer>>;
  1790. /**
  1791. * Constructs a `PATCH` request that interprets the body as a `Blob`
  1792. * and returns the full event stream.
  1793. *
  1794. * @param url The endpoint URL.
  1795. * @param body The resources to edit.
  1796. * @param options HTTP options.
  1797. *
  1798. * @return An `Observable` of all the `HttpEvent`s for the request, with the
  1799. * response body as `Blob`.
  1800. */
  1801. patch(url: string, body: any | null, options: {
  1802. headers?: HttpHeaders | Record<string, string | string[]>;
  1803. observe: 'events';
  1804. context?: HttpContext;
  1805. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1806. reportProgress?: boolean;
  1807. responseType: 'blob';
  1808. withCredentials?: boolean;
  1809. }): Observable<HttpEvent<Blob>>;
  1810. /**
  1811. * Constructs a `PATCH` request that interprets the body as a text string and
  1812. * returns the full event stream.
  1813. *
  1814. * @param url The endpoint URL.
  1815. * @param body The resources to edit.
  1816. * @param options HTTP options.
  1817. *
  1818. * @return An `Observable` of all the `HttpEvent`s for the request, with a
  1819. * response body of type string.
  1820. */
  1821. patch(url: string, body: any | null, options: {
  1822. headers?: HttpHeaders | Record<string, string | string[]>;
  1823. observe: 'events';
  1824. context?: HttpContext;
  1825. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1826. reportProgress?: boolean;
  1827. responseType: 'text';
  1828. withCredentials?: boolean;
  1829. }): Observable<HttpEvent<string>>;
  1830. /**
  1831. * Constructs a `PATCH` request that interprets the body as JSON
  1832. * and returns the full event stream.
  1833. *
  1834. * @param url The endpoint URL.
  1835. * @param body The resources to edit.
  1836. * @param options HTTP options.
  1837. *
  1838. * @return An `Observable` of all the `HttpEvent`s for the request,
  1839. * with a response body of type `Object`.
  1840. */
  1841. patch(url: string, body: any | null, options: {
  1842. headers?: HttpHeaders | Record<string, string | string[]>;
  1843. observe: 'events';
  1844. context?: HttpContext;
  1845. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1846. reportProgress?: boolean;
  1847. responseType?: 'json';
  1848. withCredentials?: boolean;
  1849. }): Observable<HttpEvent<Object>>;
  1850. /**
  1851. * Constructs a `PATCH` request that interprets the body as JSON
  1852. * and returns the full event stream.
  1853. *
  1854. * @param url The endpoint URL.
  1855. * @param body The resources to edit.
  1856. * @param options HTTP options.
  1857. *
  1858. * @return An `Observable` of all the `HttpEvent`s for the request,
  1859. * with a response body in the requested type.
  1860. */
  1861. patch<T>(url: string, body: any | null, options: {
  1862. headers?: HttpHeaders | Record<string, string | string[]>;
  1863. observe: 'events';
  1864. context?: HttpContext;
  1865. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1866. reportProgress?: boolean;
  1867. responseType?: 'json';
  1868. withCredentials?: boolean;
  1869. }): Observable<HttpEvent<T>>;
  1870. /**
  1871. * Constructs a `PATCH` request that interprets the body as an `ArrayBuffer`
  1872. * and returns the full `HttpResponse`.
  1873. *
  1874. * @param url The endpoint URL.
  1875. * @param body The resources to edit.
  1876. * @param options HTTP options.
  1877. *
  1878. * @return An `Observable` of the `HttpResponse` for the request,
  1879. * with the response body as an `ArrayBuffer`.
  1880. */
  1881. patch(url: string, body: any | null, options: {
  1882. headers?: HttpHeaders | Record<string, string | string[]>;
  1883. observe: 'response';
  1884. context?: HttpContext;
  1885. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1886. reportProgress?: boolean;
  1887. responseType: 'arraybuffer';
  1888. withCredentials?: boolean;
  1889. }): Observable<HttpResponse<ArrayBuffer>>;
  1890. /**
  1891. * Constructs a `PATCH` request that interprets the body as a `Blob` and returns the full
  1892. * `HttpResponse`.
  1893. *
  1894. * @param url The endpoint URL.
  1895. * @param body The resources to edit.
  1896. * @param options HTTP options.
  1897. *
  1898. * @return An `Observable` of the `HttpResponse` for the request,
  1899. * with the response body as a `Blob`.
  1900. */
  1901. patch(url: string, body: any | null, options: {
  1902. headers?: HttpHeaders | Record<string, string | string[]>;
  1903. observe: 'response';
  1904. context?: HttpContext;
  1905. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1906. reportProgress?: boolean;
  1907. responseType: 'blob';
  1908. withCredentials?: boolean;
  1909. }): Observable<HttpResponse<Blob>>;
  1910. /**
  1911. * Constructs a `PATCH` request that interprets the body as a text stream and returns the
  1912. * full `HttpResponse`.
  1913. *
  1914. * @param url The endpoint URL.
  1915. * @param body The resources to edit.
  1916. * @param options HTTP options.
  1917. *
  1918. * @return An `Observable` of the `HttpResponse` for the request,
  1919. * with a response body of type string.
  1920. */
  1921. patch(url: string, body: any | null, options: {
  1922. headers?: HttpHeaders | Record<string, string | string[]>;
  1923. observe: 'response';
  1924. context?: HttpContext;
  1925. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1926. reportProgress?: boolean;
  1927. responseType: 'text';
  1928. withCredentials?: boolean;
  1929. }): Observable<HttpResponse<string>>;
  1930. /**
  1931. * Constructs a `PATCH` request that interprets the body as JSON
  1932. * and returns the full `HttpResponse`.
  1933. *
  1934. * @param url The endpoint URL.
  1935. * @param body The resources to edit.
  1936. * @param options HTTP options.
  1937. *
  1938. * @return An `Observable` of the `HttpResponse` for the request,
  1939. * with a response body in the requested type.
  1940. */
  1941. patch(url: string, body: any | null, options: {
  1942. headers?: HttpHeaders | Record<string, string | string[]>;
  1943. observe: 'response';
  1944. context?: HttpContext;
  1945. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1946. reportProgress?: boolean;
  1947. responseType?: 'json';
  1948. withCredentials?: boolean;
  1949. }): Observable<HttpResponse<Object>>;
  1950. /**
  1951. * Constructs a `PATCH` request that interprets the body as JSON
  1952. * and returns the full `HttpResponse`.
  1953. *
  1954. * @param url The endpoint URL.
  1955. * @param body The resources to edit.
  1956. * @param options HTTP options.
  1957. *
  1958. * @return An `Observable` of the `HttpResponse` for the request,
  1959. * with a response body in the given type.
  1960. */
  1961. patch<T>(url: string, body: any | null, options: {
  1962. headers?: HttpHeaders | Record<string, string | string[]>;
  1963. observe: 'response';
  1964. context?: HttpContext;
  1965. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1966. reportProgress?: boolean;
  1967. responseType?: 'json';
  1968. withCredentials?: boolean;
  1969. }): Observable<HttpResponse<T>>;
  1970. /**
  1971. * Constructs a `PATCH` request that interprets the body as JSON and
  1972. * returns the response body as an object parsed from JSON.
  1973. *
  1974. * @param url The endpoint URL.
  1975. * @param body The resources to edit.
  1976. * @param options HTTP options.
  1977. *
  1978. * @return An `Observable` of the response, with the response body as an object parsed from JSON.
  1979. */
  1980. patch(url: string, body: any | null, options?: {
  1981. headers?: HttpHeaders | Record<string, string | string[]>;
  1982. context?: HttpContext;
  1983. observe?: 'body';
  1984. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  1985. reportProgress?: boolean;
  1986. responseType?: 'json';
  1987. withCredentials?: boolean;
  1988. }): Observable<Object>;
  1989. /**
  1990. * Constructs a `PATCH` request that interprets the body as JSON
  1991. * and returns the response in a given type.
  1992. *
  1993. * @param url The endpoint URL.
  1994. * @param body The resources to edit.
  1995. * @param options HTTP options.
  1996. *
  1997. * @return An `Observable` of the `HttpResponse` for the request,
  1998. * with a response body in the given type.
  1999. */
  2000. patch<T>(url: string, body: any | null, options?: {
  2001. headers?: HttpHeaders | Record<string, string | string[]>;
  2002. context?: HttpContext;
  2003. observe?: 'body';
  2004. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2005. reportProgress?: boolean;
  2006. responseType?: 'json';
  2007. withCredentials?: boolean;
  2008. }): Observable<T>;
  2009. /**
  2010. * Constructs a `POST` request that interprets the body as an `ArrayBuffer` and returns
  2011. * an `ArrayBuffer`.
  2012. *
  2013. * @param url The endpoint URL.
  2014. * @param body The content to replace with.
  2015. * @param options HTTP options.
  2016. *
  2017. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  2018. */
  2019. post(url: string, body: any | null, options: {
  2020. headers?: HttpHeaders | Record<string, string | string[]>;
  2021. context?: HttpContext;
  2022. observe?: 'body';
  2023. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2024. reportProgress?: boolean;
  2025. responseType: 'arraybuffer';
  2026. withCredentials?: boolean;
  2027. transferCache?: {
  2028. includeHeaders?: string[];
  2029. } | boolean;
  2030. }): Observable<ArrayBuffer>;
  2031. /**
  2032. * Constructs a `POST` request that interprets the body as a `Blob` and returns the
  2033. * response as a `Blob`.
  2034. *
  2035. * @param url The endpoint URL.
  2036. * @param body The content to replace with.
  2037. * @param options HTTP options
  2038. *
  2039. * @return An `Observable` of the response, with the response body as a `Blob`.
  2040. */
  2041. post(url: string, body: any | null, options: {
  2042. headers?: HttpHeaders | Record<string, string | string[]>;
  2043. context?: HttpContext;
  2044. observe?: 'body';
  2045. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2046. reportProgress?: boolean;
  2047. responseType: 'blob';
  2048. withCredentials?: boolean;
  2049. transferCache?: {
  2050. includeHeaders?: string[];
  2051. } | boolean;
  2052. }): Observable<Blob>;
  2053. /**
  2054. * Constructs a `POST` request that interprets the body as a text string and
  2055. * returns the response as a string value.
  2056. *
  2057. * @param url The endpoint URL.
  2058. * @param body The content to replace with.
  2059. * @param options HTTP options
  2060. *
  2061. * @return An `Observable` of the response, with a response body of type string.
  2062. */
  2063. post(url: string, body: any | null, options: {
  2064. headers?: HttpHeaders | Record<string, string | string[]>;
  2065. context?: HttpContext;
  2066. observe?: 'body';
  2067. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2068. reportProgress?: boolean;
  2069. responseType: 'text';
  2070. withCredentials?: boolean;
  2071. transferCache?: {
  2072. includeHeaders?: string[];
  2073. } | boolean;
  2074. }): Observable<string>;
  2075. /**
  2076. * Constructs a `POST` request that interprets the body as an `ArrayBuffer` and
  2077. * returns the full event stream.
  2078. *
  2079. * @param url The endpoint URL.
  2080. * @param body The content to replace with.
  2081. * @param options HTTP options
  2082. *
  2083. * @return An `Observable` of all `HttpEvent`s for the request,
  2084. * with the response body as an `ArrayBuffer`.
  2085. */
  2086. post(url: string, body: any | null, options: {
  2087. headers?: HttpHeaders | Record<string, string | string[]>;
  2088. observe: 'events';
  2089. context?: HttpContext;
  2090. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2091. reportProgress?: boolean;
  2092. responseType: 'arraybuffer';
  2093. withCredentials?: boolean;
  2094. transferCache?: {
  2095. includeHeaders?: string[];
  2096. } | boolean;
  2097. }): Observable<HttpEvent<ArrayBuffer>>;
  2098. /**
  2099. * Constructs a `POST` request that interprets the body as a `Blob`
  2100. * and returns the response in an observable of the full event stream.
  2101. *
  2102. * @param url The endpoint URL.
  2103. * @param body The content to replace with.
  2104. * @param options HTTP options
  2105. *
  2106. * @return An `Observable` of all `HttpEvent`s for the request, with the response body as `Blob`.
  2107. */
  2108. post(url: string, body: any | null, options: {
  2109. headers?: HttpHeaders | Record<string, string | string[]>;
  2110. observe: 'events';
  2111. context?: HttpContext;
  2112. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2113. reportProgress?: boolean;
  2114. responseType: 'blob';
  2115. withCredentials?: boolean;
  2116. transferCache?: {
  2117. includeHeaders?: string[];
  2118. } | boolean;
  2119. }): Observable<HttpEvent<Blob>>;
  2120. /**
  2121. * Constructs a `POST` request that interprets the body as a text string and returns the full
  2122. * event stream.
  2123. *
  2124. * @param url The endpoint URL.
  2125. * @param body The content to replace with.
  2126. * @param options HTTP options
  2127. *
  2128. * @return An `Observable` of all `HttpEvent`s for the request,
  2129. * with a response body of type string.
  2130. */
  2131. post(url: string, body: any | null, options: {
  2132. headers?: HttpHeaders | Record<string, string | string[]>;
  2133. observe: 'events';
  2134. context?: HttpContext;
  2135. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2136. reportProgress?: boolean;
  2137. responseType: 'text';
  2138. withCredentials?: boolean;
  2139. transferCache?: {
  2140. includeHeaders?: string[];
  2141. } | boolean;
  2142. }): Observable<HttpEvent<string>>;
  2143. /**
  2144. * Constructs a POST request that interprets the body as JSON and returns the full
  2145. * event stream.
  2146. *
  2147. * @param url The endpoint URL.
  2148. * @param body The content to replace with.
  2149. * @param options HTTP options
  2150. *
  2151. * @return An `Observable` of all `HttpEvent`s for the request,
  2152. * with a response body of type `Object`.
  2153. */
  2154. post(url: string, body: any | null, options: {
  2155. headers?: HttpHeaders | Record<string, string | string[]>;
  2156. observe: 'events';
  2157. context?: HttpContext;
  2158. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2159. reportProgress?: boolean;
  2160. responseType?: 'json';
  2161. withCredentials?: boolean;
  2162. transferCache?: {
  2163. includeHeaders?: string[];
  2164. } | boolean;
  2165. }): Observable<HttpEvent<Object>>;
  2166. /**
  2167. * Constructs a POST request that interprets the body as JSON and returns the full
  2168. * event stream.
  2169. *
  2170. * @param url The endpoint URL.
  2171. * @param body The content to replace with.
  2172. * @param options HTTP options
  2173. *
  2174. * @return An `Observable` of all `HttpEvent`s for the request,
  2175. * with a response body in the requested type.
  2176. */
  2177. post<T>(url: string, body: any | null, options: {
  2178. headers?: HttpHeaders | Record<string, string | string[]>;
  2179. observe: 'events';
  2180. context?: HttpContext;
  2181. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2182. reportProgress?: boolean;
  2183. responseType?: 'json';
  2184. withCredentials?: boolean;
  2185. transferCache?: {
  2186. includeHeaders?: string[];
  2187. } | boolean;
  2188. }): Observable<HttpEvent<T>>;
  2189. /**
  2190. * Constructs a POST request that interprets the body as an `ArrayBuffer`
  2191. * and returns the full `HttpResponse`.
  2192. *
  2193. * @param url The endpoint URL.
  2194. * @param body The content to replace with.
  2195. * @param options HTTP options
  2196. *
  2197. * @return An `Observable` of the `HttpResponse` for the request, with the response body as an
  2198. * `ArrayBuffer`.
  2199. */
  2200. post(url: string, body: any | null, options: {
  2201. headers?: HttpHeaders | Record<string, string | string[]>;
  2202. observe: 'response';
  2203. context?: HttpContext;
  2204. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2205. reportProgress?: boolean;
  2206. responseType: 'arraybuffer';
  2207. withCredentials?: boolean;
  2208. transferCache?: {
  2209. includeHeaders?: string[];
  2210. } | boolean;
  2211. }): Observable<HttpResponse<ArrayBuffer>>;
  2212. /**
  2213. * Constructs a `POST` request that interprets the body as a `Blob` and returns the full
  2214. * `HttpResponse`.
  2215. *
  2216. * @param url The endpoint URL.
  2217. * @param body The content to replace with.
  2218. * @param options HTTP options
  2219. *
  2220. * @return An `Observable` of the `HttpResponse` for the request,
  2221. * with the response body as a `Blob`.
  2222. */
  2223. post(url: string, body: any | null, options: {
  2224. headers?: HttpHeaders | Record<string, string | string[]>;
  2225. observe: 'response';
  2226. context?: HttpContext;
  2227. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2228. reportProgress?: boolean;
  2229. responseType: 'blob';
  2230. withCredentials?: boolean;
  2231. transferCache?: {
  2232. includeHeaders?: string[];
  2233. } | boolean;
  2234. }): Observable<HttpResponse<Blob>>;
  2235. /**
  2236. * Constructs a `POST` request that interprets the body as a text stream and returns
  2237. * the full `HttpResponse`.
  2238. *
  2239. * @param url The endpoint URL.
  2240. * @param body The content to replace with.
  2241. * @param options HTTP options
  2242. *
  2243. * @return An `Observable` of the `HttpResponse` for the request,
  2244. * with a response body of type string.
  2245. */
  2246. post(url: string, body: any | null, options: {
  2247. headers?: HttpHeaders | Record<string, string | string[]>;
  2248. observe: 'response';
  2249. context?: HttpContext;
  2250. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2251. reportProgress?: boolean;
  2252. responseType: 'text';
  2253. withCredentials?: boolean;
  2254. transferCache?: {
  2255. includeHeaders?: string[];
  2256. } | boolean;
  2257. }): Observable<HttpResponse<string>>;
  2258. /**
  2259. * Constructs a `POST` request that interprets the body as JSON
  2260. * and returns the full `HttpResponse`.
  2261. *
  2262. * @param url The endpoint URL.
  2263. * @param body The content to replace with.
  2264. * @param options HTTP options
  2265. *
  2266. * @return An `Observable` of the `HttpResponse` for the request, with a response body of type
  2267. * `Object`.
  2268. */
  2269. post(url: string, body: any | null, options: {
  2270. headers?: HttpHeaders | Record<string, string | string[]>;
  2271. observe: 'response';
  2272. context?: HttpContext;
  2273. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2274. reportProgress?: boolean;
  2275. responseType?: 'json';
  2276. withCredentials?: boolean;
  2277. transferCache?: {
  2278. includeHeaders?: string[];
  2279. } | boolean;
  2280. }): Observable<HttpResponse<Object>>;
  2281. /**
  2282. * Constructs a `POST` request that interprets the body as JSON and returns the
  2283. * full `HttpResponse`.
  2284. *
  2285. *
  2286. * @param url The endpoint URL.
  2287. * @param body The content to replace with.
  2288. * @param options HTTP options
  2289. *
  2290. * @return An `Observable` of the `HttpResponse` for the request, with a response body in the
  2291. * requested type.
  2292. */
  2293. post<T>(url: string, body: any | null, options: {
  2294. headers?: HttpHeaders | Record<string, string | string[]>;
  2295. observe: 'response';
  2296. context?: HttpContext;
  2297. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2298. reportProgress?: boolean;
  2299. responseType?: 'json';
  2300. withCredentials?: boolean;
  2301. transferCache?: {
  2302. includeHeaders?: string[];
  2303. } | boolean;
  2304. }): Observable<HttpResponse<T>>;
  2305. /**
  2306. * Constructs a `POST` request that interprets the body as JSON
  2307. * and returns the response body as an object parsed from JSON.
  2308. *
  2309. * @param url The endpoint URL.
  2310. * @param body The content to replace with.
  2311. * @param options HTTP options
  2312. *
  2313. * @return An `Observable` of the response, with the response body as an object parsed from JSON.
  2314. */
  2315. post(url: string, body: any | null, options?: {
  2316. headers?: HttpHeaders | Record<string, string | string[]>;
  2317. context?: HttpContext;
  2318. observe?: 'body';
  2319. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2320. reportProgress?: boolean;
  2321. responseType?: 'json';
  2322. withCredentials?: boolean;
  2323. transferCache?: {
  2324. includeHeaders?: string[];
  2325. } | boolean;
  2326. }): Observable<Object>;
  2327. /**
  2328. * Constructs a `POST` request that interprets the body as JSON
  2329. * and returns an observable of the response.
  2330. *
  2331. * @param url The endpoint URL.
  2332. * @param body The content to replace with.
  2333. * @param options HTTP options
  2334. *
  2335. * @return An `Observable` of the `HttpResponse` for the request, with a response body in the
  2336. * requested type.
  2337. */
  2338. post<T>(url: string, body: any | null, options?: {
  2339. headers?: HttpHeaders | Record<string, string | string[]>;
  2340. context?: HttpContext;
  2341. observe?: 'body';
  2342. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2343. reportProgress?: boolean;
  2344. responseType?: 'json';
  2345. withCredentials?: boolean;
  2346. transferCache?: {
  2347. includeHeaders?: string[];
  2348. } | boolean;
  2349. }): Observable<T>;
  2350. /**
  2351. * Constructs a `PUT` request that interprets the body as an `ArrayBuffer` and returns the
  2352. * response as an `ArrayBuffer`.
  2353. *
  2354. * @param url The endpoint URL.
  2355. * @param body The resources to add/update.
  2356. * @param options HTTP options
  2357. *
  2358. * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
  2359. */
  2360. put(url: string, body: any | null, options: {
  2361. headers?: HttpHeaders | Record<string, string | string[]>;
  2362. context?: HttpContext;
  2363. observe?: 'body';
  2364. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2365. reportProgress?: boolean;
  2366. responseType: 'arraybuffer';
  2367. withCredentials?: boolean;
  2368. }): Observable<ArrayBuffer>;
  2369. /**
  2370. * Constructs a `PUT` request that interprets the body as a `Blob` and returns
  2371. * the response as a `Blob`.
  2372. *
  2373. * @param url The endpoint URL.
  2374. * @param body The resources to add/update.
  2375. * @param options HTTP options
  2376. *
  2377. * @return An `Observable` of the response, with the response body as a `Blob`.
  2378. */
  2379. put(url: string, body: any | null, options: {
  2380. headers?: HttpHeaders | Record<string, string | string[]>;
  2381. context?: HttpContext;
  2382. observe?: 'body';
  2383. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2384. reportProgress?: boolean;
  2385. responseType: 'blob';
  2386. withCredentials?: boolean;
  2387. }): Observable<Blob>;
  2388. /**
  2389. * Constructs a `PUT` request that interprets the body as a text string and
  2390. * returns the response as a string value.
  2391. *
  2392. * @param url The endpoint URL.
  2393. * @param body The resources to add/update.
  2394. * @param options HTTP options
  2395. *
  2396. * @return An `Observable` of the response, with a response body of type string.
  2397. */
  2398. put(url: string, body: any | null, options: {
  2399. headers?: HttpHeaders | Record<string, string | string[]>;
  2400. context?: HttpContext;
  2401. observe?: 'body';
  2402. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2403. reportProgress?: boolean;
  2404. responseType: 'text';
  2405. withCredentials?: boolean;
  2406. }): Observable<string>;
  2407. /**
  2408. * Constructs a `PUT` request that interprets the body as an `ArrayBuffer` and
  2409. * returns the full event stream.
  2410. *
  2411. * @param url The endpoint URL.
  2412. * @param body The resources to add/update.
  2413. * @param options HTTP options
  2414. *
  2415. * @return An `Observable` of all `HttpEvent`s for the request,
  2416. * with the response body as an `ArrayBuffer`.
  2417. */
  2418. put(url: string, body: any | null, options: {
  2419. headers?: HttpHeaders | Record<string, string | string[]>;
  2420. observe: 'events';
  2421. context?: HttpContext;
  2422. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2423. reportProgress?: boolean;
  2424. responseType: 'arraybuffer';
  2425. withCredentials?: boolean;
  2426. }): Observable<HttpEvent<ArrayBuffer>>;
  2427. /**
  2428. * Constructs a `PUT` request that interprets the body as a `Blob` and returns the full event
  2429. * stream.
  2430. *
  2431. * @param url The endpoint URL.
  2432. * @param body The resources to add/update.
  2433. * @param options HTTP options
  2434. *
  2435. * @return An `Observable` of all `HttpEvent`s for the request,
  2436. * with the response body as a `Blob`.
  2437. */
  2438. put(url: string, body: any | null, options: {
  2439. headers?: HttpHeaders | Record<string, string | string[]>;
  2440. observe: 'events';
  2441. context?: HttpContext;
  2442. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2443. reportProgress?: boolean;
  2444. responseType: 'blob';
  2445. withCredentials?: boolean;
  2446. }): Observable<HttpEvent<Blob>>;
  2447. /**
  2448. * Constructs a `PUT` request that interprets the body as a text string and returns the full event
  2449. * stream.
  2450. *
  2451. * @param url The endpoint URL.
  2452. * @param body The resources to add/update.
  2453. * @param options HTTP options
  2454. *
  2455. * @return An `Observable` of all `HttpEvent`s for the request, with a response body
  2456. * of type string.
  2457. */
  2458. put(url: string, body: any | null, options: {
  2459. headers?: HttpHeaders | Record<string, string | string[]>;
  2460. observe: 'events';
  2461. context?: HttpContext;
  2462. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2463. reportProgress?: boolean;
  2464. responseType: 'text';
  2465. withCredentials?: boolean;
  2466. }): Observable<HttpEvent<string>>;
  2467. /**
  2468. * Constructs a `PUT` request that interprets the body as JSON and returns the full
  2469. * event stream.
  2470. *
  2471. * @param url The endpoint URL.
  2472. * @param body The resources to add/update.
  2473. * @param options HTTP options
  2474. *
  2475. * @return An `Observable` of all `HttpEvent`s for the request, with a response body of
  2476. * type `Object`.
  2477. */
  2478. put(url: string, body: any | null, options: {
  2479. headers?: HttpHeaders | Record<string, string | string[]>;
  2480. observe: 'events';
  2481. context?: HttpContext;
  2482. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2483. reportProgress?: boolean;
  2484. responseType?: 'json';
  2485. withCredentials?: boolean;
  2486. }): Observable<HttpEvent<Object>>;
  2487. /**
  2488. * Constructs a `PUT` request that interprets the body as JSON and returns the
  2489. * full event stream.
  2490. *
  2491. * @param url The endpoint URL.
  2492. * @param body The resources to add/update.
  2493. * @param options HTTP options
  2494. *
  2495. * @return An `Observable` of all `HttpEvent`s for the request,
  2496. * with a response body in the requested type.
  2497. */
  2498. put<T>(url: string, body: any | null, options: {
  2499. headers?: HttpHeaders | Record<string, string | string[]>;
  2500. observe: 'events';
  2501. context?: HttpContext;
  2502. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2503. reportProgress?: boolean;
  2504. responseType?: 'json';
  2505. withCredentials?: boolean;
  2506. }): Observable<HttpEvent<T>>;
  2507. /**
  2508. * Constructs a `PUT` request that interprets the body as an
  2509. * `ArrayBuffer` and returns an observable of the full HTTP response.
  2510. *
  2511. * @param url The endpoint URL.
  2512. * @param body The resources to add/update.
  2513. * @param options HTTP options
  2514. *
  2515. * @return An `Observable` of the `HttpResponse` for the request, with the response body as an
  2516. * `ArrayBuffer`.
  2517. */
  2518. put(url: string, body: any | null, options: {
  2519. headers?: HttpHeaders | Record<string, string | string[]>;
  2520. observe: 'response';
  2521. context?: HttpContext;
  2522. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2523. reportProgress?: boolean;
  2524. responseType: 'arraybuffer';
  2525. withCredentials?: boolean;
  2526. }): Observable<HttpResponse<ArrayBuffer>>;
  2527. /**
  2528. * Constructs a `PUT` request that interprets the body as a `Blob` and returns the
  2529. * full HTTP response.
  2530. *
  2531. * @param url The endpoint URL.
  2532. * @param body The resources to add/update.
  2533. * @param options HTTP options
  2534. *
  2535. * @return An `Observable` of the `HttpResponse` for the request,
  2536. * with the response body as a `Blob`.
  2537. */
  2538. put(url: string, body: any | null, options: {
  2539. headers?: HttpHeaders | Record<string, string | string[]>;
  2540. observe: 'response';
  2541. context?: HttpContext;
  2542. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2543. reportProgress?: boolean;
  2544. responseType: 'blob';
  2545. withCredentials?: boolean;
  2546. }): Observable<HttpResponse<Blob>>;
  2547. /**
  2548. * Constructs a `PUT` request that interprets the body as a text stream and returns the
  2549. * full HTTP response.
  2550. *
  2551. * @param url The endpoint URL.
  2552. * @param body The resources to add/update.
  2553. * @param options HTTP options
  2554. *
  2555. * @return An `Observable` of the `HttpResponse` for the request, with a response body of type
  2556. * string.
  2557. */
  2558. put(url: string, body: any | null, options: {
  2559. headers?: HttpHeaders | Record<string, string | string[]>;
  2560. observe: 'response';
  2561. context?: HttpContext;
  2562. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2563. reportProgress?: boolean;
  2564. responseType: 'text';
  2565. withCredentials?: boolean;
  2566. }): Observable<HttpResponse<string>>;
  2567. /**
  2568. * Constructs a `PUT` request that interprets the body as JSON and returns the full
  2569. * HTTP response.
  2570. *
  2571. * @param url The endpoint URL.
  2572. * @param body The resources to add/update.
  2573. * @param options HTTP options
  2574. *
  2575. * @return An `Observable` of the `HttpResponse` for the request, with a response body
  2576. * of type 'Object`.
  2577. */
  2578. put(url: string, body: any | null, options: {
  2579. headers?: HttpHeaders | Record<string, string | string[]>;
  2580. observe: 'response';
  2581. context?: HttpContext;
  2582. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2583. reportProgress?: boolean;
  2584. responseType?: 'json';
  2585. withCredentials?: boolean;
  2586. }): Observable<HttpResponse<Object>>;
  2587. /**
  2588. * Constructs a `PUT` request that interprets the body as an instance of the requested type and
  2589. * returns the full HTTP response.
  2590. *
  2591. * @param url The endpoint URL.
  2592. * @param body The resources to add/update.
  2593. * @param options HTTP options
  2594. *
  2595. * @return An `Observable` of the `HttpResponse` for the request,
  2596. * with a response body in the requested type.
  2597. */
  2598. put<T>(url: string, body: any | null, options: {
  2599. headers?: HttpHeaders | Record<string, string | string[]>;
  2600. observe: 'response';
  2601. context?: HttpContext;
  2602. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2603. reportProgress?: boolean;
  2604. responseType?: 'json';
  2605. withCredentials?: boolean;
  2606. }): Observable<HttpResponse<T>>;
  2607. /**
  2608. * Constructs a `PUT` request that interprets the body as JSON
  2609. * and returns an observable of JavaScript object.
  2610. *
  2611. * @param url The endpoint URL.
  2612. * @param body The resources to add/update.
  2613. * @param options HTTP options
  2614. *
  2615. * @return An `Observable` of the response as a JavaScript object.
  2616. */
  2617. put(url: string, body: any | null, options?: {
  2618. headers?: HttpHeaders | Record<string, string | string[]>;
  2619. context?: HttpContext;
  2620. observe?: 'body';
  2621. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2622. reportProgress?: boolean;
  2623. responseType?: 'json';
  2624. withCredentials?: boolean;
  2625. }): Observable<Object>;
  2626. /**
  2627. * Constructs a `PUT` request that interprets the body as an instance of the requested type
  2628. * and returns an observable of the requested type.
  2629. *
  2630. * @param url The endpoint URL.
  2631. * @param body The resources to add/update.
  2632. * @param options HTTP options
  2633. *
  2634. * @return An `Observable` of the requested type.
  2635. */
  2636. put<T>(url: string, body: any | null, options?: {
  2637. headers?: HttpHeaders | Record<string, string | string[]>;
  2638. context?: HttpContext;
  2639. observe?: 'body';
  2640. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  2641. reportProgress?: boolean;
  2642. responseType?: 'json';
  2643. withCredentials?: boolean;
  2644. }): Observable<T>;
  2645. static ɵfac: i0.ɵɵFactoryDeclaration<HttpClient, never>;
  2646. static ɵprov: i0.ɵɵInjectableDeclaration<HttpClient>;
  2647. }
  2648. /**
  2649. * Uses `fetch` to send requests to a backend server.
  2650. *
  2651. * This `FetchBackend` requires the support of the
  2652. * [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) which is available on all
  2653. * supported browsers and on Node.js v18 or later.
  2654. *
  2655. * @see {@link HttpHandler}
  2656. *
  2657. * @publicApi
  2658. */
  2659. declare class FetchBackend implements HttpBackend {
  2660. private readonly fetchImpl;
  2661. private readonly ngZone;
  2662. private readonly destroyRef;
  2663. private destroyed;
  2664. constructor();
  2665. handle(request: HttpRequest<any>): Observable<HttpEvent<any>>;
  2666. private doRequest;
  2667. private parseBody;
  2668. private createRequestInit;
  2669. private concatChunks;
  2670. static ɵfac: i0.ɵɵFactoryDeclaration<FetchBackend, never>;
  2671. static ɵprov: i0.ɵɵInjectableDeclaration<FetchBackend>;
  2672. }
  2673. /**
  2674. * Intercepts and handles an `HttpRequest` or `HttpResponse`.
  2675. *
  2676. * Most interceptors transform the outgoing request before passing it to the
  2677. * next interceptor in the chain, by calling `next.handle(transformedReq)`.
  2678. * An interceptor may transform the
  2679. * response event stream as well, by applying additional RxJS operators on the stream
  2680. * returned by `next.handle()`.
  2681. *
  2682. * More rarely, an interceptor may handle the request entirely,
  2683. * and compose a new event stream instead of invoking `next.handle()`. This is an
  2684. * acceptable behavior, but keep in mind that further interceptors will be skipped entirely.
  2685. *
  2686. * It is also rare but valid for an interceptor to return multiple responses on the
  2687. * event stream for a single request.
  2688. *
  2689. * @publicApi
  2690. *
  2691. * @see [HTTP Guide](guide/http/interceptors)
  2692. * @see {@link HttpInterceptorFn}
  2693. *
  2694. * @usageNotes
  2695. *
  2696. * To use the same instance of `HttpInterceptors` for the entire app, import the `HttpClientModule`
  2697. * only in your `AppModule`, and add the interceptors to the root application injector.
  2698. * If you import `HttpClientModule` multiple times across different modules (for example, in lazy
  2699. * loading modules), each import creates a new copy of the `HttpClientModule`, which overwrites the
  2700. * interceptors provided in the root module.
  2701. */
  2702. interface HttpInterceptor {
  2703. /**
  2704. * Identifies and handles a given HTTP request.
  2705. * @param req The outgoing request object to handle.
  2706. * @param next The next interceptor in the chain, or the backend
  2707. * if no interceptors remain in the chain.
  2708. * @returns An observable of the event stream.
  2709. */
  2710. intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
  2711. }
  2712. /**
  2713. * Represents the next interceptor in an interceptor chain, or the real backend if there are no
  2714. * further interceptors.
  2715. *
  2716. * Most interceptors will delegate to this function, and either modify the outgoing request or the
  2717. * response when it arrives. Within the scope of the current request, however, this function may be
  2718. * called any number of times, for any number of downstream requests. Such downstream requests need
  2719. * not be to the same URL or even the same origin as the current request. It is also valid to not
  2720. * call the downstream handler at all, and process the current request entirely within the
  2721. * interceptor.
  2722. *
  2723. * This function should only be called within the scope of the request that's currently being
  2724. * intercepted. Once that request is complete, this downstream handler function should not be
  2725. * called.
  2726. *
  2727. * @publicApi
  2728. *
  2729. * @see [HTTP Guide](guide/http/interceptors)
  2730. */
  2731. type HttpHandlerFn = (req: HttpRequest<unknown>) => Observable<HttpEvent<unknown>>;
  2732. /**
  2733. * An interceptor for HTTP requests made via `HttpClient`.
  2734. *
  2735. * `HttpInterceptorFn`s are middleware functions which `HttpClient` calls when a request is made.
  2736. * These functions have the opportunity to modify the outgoing request or any response that comes
  2737. * back, as well as block, redirect, or otherwise change the request or response semantics.
  2738. *
  2739. * An `HttpHandlerFn` representing the next interceptor (or the backend which will make a real HTTP
  2740. * request) is provided. Most interceptors will delegate to this function, but that is not required
  2741. * (see `HttpHandlerFn` for more details).
  2742. *
  2743. * `HttpInterceptorFn`s are executed in an [injection context](guide/di/dependency-injection-context).
  2744. * They have access to `inject()` via the `EnvironmentInjector` from which they were configured.
  2745. *
  2746. * @see [HTTP Guide](guide/http/interceptors)
  2747. * @see {@link withInterceptors}
  2748. *
  2749. * @usageNotes
  2750. * Here is a noop interceptor that passes the request through without modifying it:
  2751. * ```ts
  2752. * export const noopInterceptor: HttpInterceptorFn = (req: HttpRequest<unknown>, next:
  2753. * HttpHandlerFn) => {
  2754. * return next(modifiedReq);
  2755. * };
  2756. * ```
  2757. *
  2758. * If you want to alter a request, clone it first and modify the clone before passing it to the
  2759. * `next()` handler function.
  2760. *
  2761. * Here is a basic interceptor that adds a bearer token to the headers
  2762. * ```ts
  2763. * export const authenticationInterceptor: HttpInterceptorFn = (req: HttpRequest<unknown>, next:
  2764. * HttpHandlerFn) => {
  2765. * const userToken = 'MY_TOKEN'; const modifiedReq = req.clone({
  2766. * headers: req.headers.set('Authorization', `Bearer ${userToken}`),
  2767. * });
  2768. *
  2769. * return next(modifiedReq);
  2770. * };
  2771. * ```
  2772. */
  2773. type HttpInterceptorFn = (req: HttpRequest<unknown>, next: HttpHandlerFn) => Observable<HttpEvent<unknown>>;
  2774. /**
  2775. * A multi-provider token that represents the array of registered
  2776. * `HttpInterceptor` objects.
  2777. *
  2778. * @publicApi
  2779. */
  2780. declare const HTTP_INTERCEPTORS: InjectionToken<readonly HttpInterceptor[]>;
  2781. /**
  2782. * A multi-provided token of `HttpInterceptorFn`s that are only set in root.
  2783. */
  2784. declare const HTTP_ROOT_INTERCEPTOR_FNS: InjectionToken<readonly HttpInterceptorFn[]>;
  2785. declare const REQUESTS_CONTRIBUTE_TO_STABILITY: InjectionToken<boolean>;
  2786. declare class HttpInterceptorHandler extends HttpHandler {
  2787. private backend;
  2788. private injector;
  2789. private chain;
  2790. private readonly pendingTasks;
  2791. private readonly contributeToStability;
  2792. constructor(backend: HttpBackend, injector: EnvironmentInjector);
  2793. handle(initialRequest: HttpRequest<any>): Observable<HttpEvent<any>>;
  2794. static ɵfac: i0.ɵɵFactoryDeclaration<HttpInterceptorHandler, never>;
  2795. static ɵprov: i0.ɵɵInjectableDeclaration<HttpInterceptorHandler>;
  2796. }
  2797. /**
  2798. * DI token/abstract type representing a map of JSONP callbacks.
  2799. *
  2800. * In the browser, this should always be the `window` object.
  2801. *
  2802. *
  2803. */
  2804. declare abstract class JsonpCallbackContext {
  2805. [key: string]: (data: any) => void;
  2806. }
  2807. /**
  2808. * Processes an `HttpRequest` with the JSONP method,
  2809. * by performing JSONP style requests.
  2810. * @see {@link HttpHandler}
  2811. * @see {@link HttpXhrBackend}
  2812. *
  2813. * @publicApi
  2814. */
  2815. declare class JsonpClientBackend implements HttpBackend {
  2816. private callbackMap;
  2817. private document;
  2818. /**
  2819. * A resolved promise that can be used to schedule microtasks in the event handlers.
  2820. */
  2821. private readonly resolvedPromise;
  2822. constructor(callbackMap: JsonpCallbackContext, document: any);
  2823. /**
  2824. * Get the name of the next callback method, by incrementing the global `nextRequestId`.
  2825. */
  2826. private nextCallback;
  2827. /**
  2828. * Processes a JSONP request and returns an event stream of the results.
  2829. * @param req The request object.
  2830. * @returns An observable of the response events.
  2831. *
  2832. */
  2833. handle(req: HttpRequest<never>): Observable<HttpEvent<any>>;
  2834. private removeListeners;
  2835. static ɵfac: i0.ɵɵFactoryDeclaration<JsonpClientBackend, never>;
  2836. static ɵprov: i0.ɵɵInjectableDeclaration<JsonpClientBackend>;
  2837. }
  2838. /**
  2839. * Identifies requests with the method JSONP and
  2840. * shifts them to the `JsonpClientBackend`.
  2841. *
  2842. * @see {@link HttpInterceptor}
  2843. *
  2844. * @publicApi
  2845. */
  2846. declare class JsonpInterceptor {
  2847. private injector;
  2848. constructor(injector: EnvironmentInjector);
  2849. /**
  2850. * Identifies and handles a given JSONP request.
  2851. * @param initialRequest The outgoing request object to handle.
  2852. * @param next The next interceptor in the chain, or the backend
  2853. * if no interceptors remain in the chain.
  2854. * @returns An observable of the event stream.
  2855. */
  2856. intercept(initialRequest: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
  2857. static ɵfac: i0.ɵɵFactoryDeclaration<JsonpInterceptor, never>;
  2858. static ɵprov: i0.ɵɵInjectableDeclaration<JsonpInterceptor>;
  2859. }
  2860. /**
  2861. * Identifies a particular kind of `HttpFeature`.
  2862. *
  2863. * @publicApi
  2864. */
  2865. declare enum HttpFeatureKind {
  2866. Interceptors = 0,
  2867. LegacyInterceptors = 1,
  2868. CustomXsrfConfiguration = 2,
  2869. NoXsrfProtection = 3,
  2870. JsonpSupport = 4,
  2871. RequestsMadeViaParent = 5,
  2872. Fetch = 6
  2873. }
  2874. /**
  2875. * A feature for use when configuring `provideHttpClient`.
  2876. *
  2877. * @publicApi
  2878. */
  2879. interface HttpFeature<KindT extends HttpFeatureKind> {
  2880. ɵkind: KindT;
  2881. ɵproviders: Provider[];
  2882. }
  2883. /**
  2884. * Configures Angular's `HttpClient` service to be available for injection.
  2885. *
  2886. * By default, `HttpClient` will be configured for injection with its default options for XSRF
  2887. * protection of outgoing requests. Additional configuration options can be provided by passing
  2888. * feature functions to `provideHttpClient`. For example, HTTP interceptors can be added using the
  2889. * `withInterceptors(...)` feature.
  2890. *
  2891. * <div class="docs-alert docs-alert-helpful">
  2892. *
  2893. * It's strongly recommended to enable
  2894. * [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) for applications that use
  2895. * Server-Side Rendering for better performance and compatibility. To enable `fetch`, add
  2896. * `withFetch()` feature to the `provideHttpClient()` call at the root of the application:
  2897. *
  2898. * ```ts
  2899. * provideHttpClient(withFetch());
  2900. * ```
  2901. *
  2902. * </div>
  2903. *
  2904. * @see {@link withInterceptors}
  2905. * @see {@link withInterceptorsFromDi}
  2906. * @see {@link withXsrfConfiguration}
  2907. * @see {@link withNoXsrfProtection}
  2908. * @see {@link withJsonpSupport}
  2909. * @see {@link withRequestsMadeViaParent}
  2910. * @see {@link withFetch}
  2911. */
  2912. declare function provideHttpClient(...features: HttpFeature<HttpFeatureKind>[]): EnvironmentProviders;
  2913. /**
  2914. * Adds one or more functional-style HTTP interceptors to the configuration of the `HttpClient`
  2915. * instance.
  2916. *
  2917. * @see {@link HttpInterceptorFn}
  2918. * @see {@link provideHttpClient}
  2919. * @publicApi
  2920. */
  2921. declare function withInterceptors(interceptorFns: HttpInterceptorFn[]): HttpFeature<HttpFeatureKind.Interceptors>;
  2922. /**
  2923. * Includes class-based interceptors configured using a multi-provider in the current injector into
  2924. * the configured `HttpClient` instance.
  2925. *
  2926. * Prefer `withInterceptors` and functional interceptors instead, as support for DI-provided
  2927. * interceptors may be phased out in a later release.
  2928. *
  2929. * @see {@link HttpInterceptor}
  2930. * @see {@link HTTP_INTERCEPTORS}
  2931. * @see {@link provideHttpClient}
  2932. */
  2933. declare function withInterceptorsFromDi(): HttpFeature<HttpFeatureKind.LegacyInterceptors>;
  2934. /**
  2935. * Customizes the XSRF protection for the configuration of the current `HttpClient` instance.
  2936. *
  2937. * This feature is incompatible with the `withNoXsrfProtection` feature.
  2938. *
  2939. * @see {@link provideHttpClient}
  2940. */
  2941. declare function withXsrfConfiguration({ cookieName, headerName, }: {
  2942. cookieName?: string;
  2943. headerName?: string;
  2944. }): HttpFeature<HttpFeatureKind.CustomXsrfConfiguration>;
  2945. /**
  2946. * Disables XSRF protection in the configuration of the current `HttpClient` instance.
  2947. *
  2948. * This feature is incompatible with the `withXsrfConfiguration` feature.
  2949. *
  2950. * @see {@link provideHttpClient}
  2951. */
  2952. declare function withNoXsrfProtection(): HttpFeature<HttpFeatureKind.NoXsrfProtection>;
  2953. /**
  2954. * Add JSONP support to the configuration of the current `HttpClient` instance.
  2955. *
  2956. * @see {@link provideHttpClient}
  2957. */
  2958. declare function withJsonpSupport(): HttpFeature<HttpFeatureKind.JsonpSupport>;
  2959. /**
  2960. * Configures the current `HttpClient` instance to make requests via the parent injector's
  2961. * `HttpClient` instead of directly.
  2962. *
  2963. * By default, `provideHttpClient` configures `HttpClient` in its injector to be an independent
  2964. * instance. For example, even if `HttpClient` is configured in the parent injector with
  2965. * one or more interceptors, they will not intercept requests made via this instance.
  2966. *
  2967. * With this option enabled, once the request has passed through the current injector's
  2968. * interceptors, it will be delegated to the parent injector's `HttpClient` chain instead of
  2969. * dispatched directly, and interceptors in the parent configuration will be applied to the request.
  2970. *
  2971. * If there are several `HttpClient` instances in the injector hierarchy, it's possible for
  2972. * `withRequestsMadeViaParent` to be used at multiple levels, which will cause the request to
  2973. * "bubble up" until either reaching the root level or an `HttpClient` which was not configured with
  2974. * this option.
  2975. *
  2976. * @see {@link provideHttpClient}
  2977. * @publicApi
  2978. */
  2979. declare function withRequestsMadeViaParent(): HttpFeature<HttpFeatureKind.RequestsMadeViaParent>;
  2980. /**
  2981. * Configures the current `HttpClient` instance to make requests using the fetch API.
  2982. *
  2983. * Note: The Fetch API doesn't support progress report on uploads.
  2984. *
  2985. * @publicApi
  2986. */
  2987. declare function withFetch(): HttpFeature<HttpFeatureKind.Fetch>;
  2988. /**
  2989. * The structure of an `httpResource` request which will be sent to the backend.
  2990. *
  2991. * @experimental
  2992. */
  2993. interface HttpResourceRequest {
  2994. /**
  2995. * URL of the request.
  2996. *
  2997. * This URL should not include query parameters. Instead, specify query parameters through the
  2998. * `params` field.
  2999. */
  3000. url: string;
  3001. /**
  3002. * HTTP method of the request, which defaults to GET if not specified.
  3003. */
  3004. method?: string;
  3005. /**
  3006. * Body to send with the request, if there is one.
  3007. *
  3008. * If no Content-Type header is specified by the user, Angular will attempt to set one based on
  3009. * the type of `body`.
  3010. */
  3011. body?: unknown;
  3012. /**
  3013. * Dictionary of query parameters which will be appeneded to the request URL.
  3014. */
  3015. params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
  3016. /**
  3017. * Dictionary of headers to include with the outgoing request.
  3018. */
  3019. headers?: HttpHeaders | Record<string, string | ReadonlyArray<string>>;
  3020. /**
  3021. * Context of the request stored in a dictionary of key-value pairs.
  3022. */
  3023. context?: HttpContext;
  3024. /**
  3025. * If `true`, progress events will be enabled for the request and delivered through the
  3026. * `HttpResource.progress` signal.
  3027. */
  3028. reportProgress?: boolean;
  3029. /**
  3030. * Specifies whether the `withCredentials` flag should be set on the outgoing request.
  3031. *
  3032. * This flag causes the browser to send cookies and other authentication information along with
  3033. * the request.
  3034. */
  3035. withCredentials?: boolean;
  3036. /**
  3037. * Configures the server-side rendering transfer cache for this request.
  3038. *
  3039. * See the documentation on the transfer cache for more information.
  3040. */
  3041. transferCache?: {
  3042. includeHeaders?: string[];
  3043. } | boolean;
  3044. }
  3045. /**
  3046. * Options for creating an `httpResource`.
  3047. *
  3048. * @experimental
  3049. */
  3050. interface HttpResourceOptions<TResult, TRaw> {
  3051. /**
  3052. * Transform the result of the HTTP request before it's delivered to the resource.
  3053. *
  3054. * `parse` receives the value from the HTTP layer as its raw type (e.g. as `unknown` for JSON data).
  3055. * It can be used to validate or transform the type of the resource, and return a more specific
  3056. * type. This is also useful for validating backend responses using a runtime schema validation
  3057. * library such as Zod.
  3058. */
  3059. parse?: (value: TRaw) => TResult;
  3060. /**
  3061. * Value that the resource will take when in Idle, Loading, or Error states.
  3062. *
  3063. * If not set, the resource will use `undefined` as its default value.
  3064. */
  3065. defaultValue?: NoInfer<TResult>;
  3066. /**
  3067. * The `Injector` in which to create the `httpResource`.
  3068. *
  3069. * If this is not provided, the current [injection context](guide/di/dependency-injection-context)
  3070. * will be used instead (via `inject`).
  3071. */
  3072. injector?: Injector;
  3073. /**
  3074. * A comparison function which defines equality for the response value.
  3075. */
  3076. equal?: ValueEqualityFn<NoInfer<TResult>>;
  3077. }
  3078. /**
  3079. * A `WritableResource` that represents the results of a reactive HTTP request.
  3080. *
  3081. * `HttpResource`s are backed by `HttpClient`, including support for interceptors, testing, and the
  3082. * other features of the `HttpClient` API.
  3083. *
  3084. * @experimental
  3085. */
  3086. interface HttpResourceRef<T> extends WritableResource<T>, ResourceRef<T> {
  3087. /**
  3088. * Signal of the response headers, when available.
  3089. */
  3090. readonly headers: Signal<HttpHeaders | undefined>;
  3091. /**
  3092. * Signal of the response status code, when available.
  3093. */
  3094. readonly statusCode: Signal<number | undefined>;
  3095. /**
  3096. * Signal of the latest progress update, if the request was made with `reportProgress: true`.
  3097. */
  3098. readonly progress: Signal<HttpProgressEvent | undefined>;
  3099. hasValue(): this is HttpResourceRef<Exclude<T, undefined>>;
  3100. destroy(): void;
  3101. }
  3102. /**
  3103. * Type for the `httpRequest` top-level function, which includes the call signatures for the JSON-
  3104. * based `httpRequest` as well as sub-functions for `ArrayBuffer`, `Blob`, and `string` type
  3105. * requests.
  3106. *
  3107. * @experimental
  3108. */
  3109. interface HttpResourceFn {
  3110. /**
  3111. * Create a `Resource` that fetches data with an HTTP GET request to the given URL.
  3112. *
  3113. * If a reactive function is passed for the URL, the resource will update when the URL changes via
  3114. * signals.
  3115. *
  3116. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  3117. * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of
  3118. * `httpResource`, such as `httpResource.text()`, to parse the response differently.
  3119. *
  3120. * @experimental
  3121. */
  3122. <TResult = unknown>(url: string | (() => string | undefined), options: HttpResourceOptions<TResult, unknown> & {
  3123. defaultValue: NoInfer<TResult>;
  3124. }): HttpResourceRef<TResult>;
  3125. /**
  3126. * Create a `Resource` that fetches data with an HTTP GET request to the given URL.
  3127. *
  3128. * If a reactive function is passed for the URL, the resource will update when the URL changes via
  3129. * signals.
  3130. *
  3131. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  3132. * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of
  3133. * `httpResource`, such as `httpResource.text()`, to parse the response differently.
  3134. *
  3135. * @experimental
  3136. */
  3137. <TResult = unknown>(url: string | (() => string | undefined), options?: HttpResourceOptions<TResult, unknown>): HttpResourceRef<TResult | undefined>;
  3138. /**
  3139. * Create a `Resource` that fetches data with the configured HTTP request.
  3140. *
  3141. * If a reactive function is passed for the request, the resource will update when the request
  3142. * changes via signals.
  3143. *
  3144. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  3145. * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of
  3146. * `httpResource`, such as `httpResource.text()`, to parse the response differently.
  3147. *
  3148. * @experimental
  3149. */
  3150. <TResult = unknown>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options: HttpResourceOptions<TResult, unknown> & {
  3151. defaultValue: NoInfer<TResult>;
  3152. }): HttpResourceRef<TResult>;
  3153. /**
  3154. * Create a `Resource` that fetches data with the configured HTTP request.
  3155. *
  3156. * If a reactive function is passed for the request, the resource will update when the request
  3157. * changes via signals.
  3158. *
  3159. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  3160. * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of
  3161. * `httpResource`, such as `httpResource.text()`, to parse the response differently.
  3162. *
  3163. * @experimental
  3164. */
  3165. <TResult = unknown>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options?: HttpResourceOptions<TResult, unknown>): HttpResourceRef<TResult | undefined>;
  3166. /**
  3167. * Create a `Resource` that fetches data with the configured HTTP request.
  3168. *
  3169. * If a reactive function is passed for the URL or request, the resource will update when the
  3170. * URL or request changes via signals.
  3171. *
  3172. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  3173. * of the `HttpClient` API. Data is parsed into an `ArrayBuffer`.
  3174. *
  3175. * @experimental
  3176. */
  3177. arrayBuffer: {
  3178. <TResult = ArrayBuffer>(url: string | (() => string | undefined), options: HttpResourceOptions<TResult, ArrayBuffer> & {
  3179. defaultValue: NoInfer<TResult>;
  3180. }): HttpResourceRef<TResult>;
  3181. <TResult = ArrayBuffer>(url: string | (() => string | undefined), options?: HttpResourceOptions<TResult, ArrayBuffer>): HttpResourceRef<TResult | undefined>;
  3182. <TResult = ArrayBuffer>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options: HttpResourceOptions<TResult, ArrayBuffer> & {
  3183. defaultValue: NoInfer<TResult>;
  3184. }): HttpResourceRef<TResult>;
  3185. <TResult = ArrayBuffer>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options?: HttpResourceOptions<TResult, ArrayBuffer>): HttpResourceRef<TResult | undefined>;
  3186. };
  3187. /**
  3188. * Create a `Resource` that fetches data with the configured HTTP request.
  3189. *
  3190. * If a reactive function is passed for the URL or request, the resource will update when the
  3191. * URL or request changes via signals.
  3192. *
  3193. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  3194. * of the `HttpClient` API. Data is parsed into a `Blob`.
  3195. *
  3196. * @experimental
  3197. */
  3198. blob: {
  3199. <TResult = Blob>(url: string | (() => string | undefined), options: HttpResourceOptions<TResult, Blob> & {
  3200. defaultValue: NoInfer<TResult>;
  3201. }): HttpResourceRef<TResult>;
  3202. <TResult = Blob>(url: string | (() => string | undefined), options?: HttpResourceOptions<TResult, Blob>): HttpResourceRef<TResult | undefined>;
  3203. <TResult = Blob>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options: HttpResourceOptions<TResult, Blob> & {
  3204. defaultValue: NoInfer<TResult>;
  3205. }): HttpResourceRef<TResult>;
  3206. <TResult = Blob>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options?: HttpResourceOptions<TResult, Blob>): HttpResourceRef<TResult | undefined>;
  3207. };
  3208. /**
  3209. * Create a `Resource` that fetches data with the configured HTTP request.
  3210. *
  3211. * If a reactive function is passed for the URL or request, the resource will update when the
  3212. * URL or request changes via signals.
  3213. *
  3214. * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features
  3215. * of the `HttpClient` API. Data is parsed as a `string`.
  3216. *
  3217. * @experimental
  3218. */
  3219. text: {
  3220. <TResult = string>(url: string | (() => string | undefined), options: HttpResourceOptions<TResult, string> & {
  3221. defaultValue: NoInfer<TResult>;
  3222. }): HttpResourceRef<TResult>;
  3223. <TResult = string>(url: string | (() => string | undefined), options?: HttpResourceOptions<TResult, string>): HttpResourceRef<TResult | undefined>;
  3224. <TResult = string>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options: HttpResourceOptions<TResult, string> & {
  3225. defaultValue: NoInfer<TResult>;
  3226. }): HttpResourceRef<TResult>;
  3227. <TResult = string>(request: HttpResourceRequest | (() => HttpResourceRequest | undefined), options?: HttpResourceOptions<TResult, string>): HttpResourceRef<TResult | undefined>;
  3228. };
  3229. }
  3230. /**
  3231. * `httpResource` makes a reactive HTTP request and exposes the request status and response value as
  3232. * a `WritableResource`. By default, it assumes that the backend will return JSON data. To make a
  3233. * request that expects a different kind of data, you can use a sub-constructor of `httpResource`,
  3234. * such as `httpResource.text`.
  3235. *
  3236. * @experimental
  3237. * @initializerApiFunction
  3238. */
  3239. declare const httpResource: HttpResourceFn;
  3240. /**
  3241. * Options to configure how TransferCache should be used to cache requests made via HttpClient.
  3242. *
  3243. * @param includeHeaders Specifies which headers should be included into cached responses. No
  3244. * headers are included by default.
  3245. * @param filter A function that receives a request as an argument and returns a boolean to indicate
  3246. * whether a request should be included into the cache.
  3247. * @param includePostRequests Enables caching for POST requests. By default, only GET and HEAD
  3248. * requests are cached. This option can be enabled if POST requests are used to retrieve data
  3249. * (for example using GraphQL).
  3250. * @param includeRequestsWithAuthHeaders Enables caching of requests containing either `Authorization`
  3251. * or `Proxy-Authorization` headers. By default, these requests are excluded from caching.
  3252. *
  3253. * @publicApi
  3254. */
  3255. type HttpTransferCacheOptions = {
  3256. includeHeaders?: string[];
  3257. filter?: (req: HttpRequest<unknown>) => boolean;
  3258. includePostRequests?: boolean;
  3259. includeRequestsWithAuthHeaders?: boolean;
  3260. };
  3261. /**
  3262. * If your application uses different HTTP origins to make API calls (via `HttpClient`) on the server and
  3263. * on the client, the `HTTP_TRANSFER_CACHE_ORIGIN_MAP` token allows you to establish a mapping
  3264. * between those origins, so that `HttpTransferCache` feature can recognize those requests as the same
  3265. * ones and reuse the data cached on the server during hydration on the client.
  3266. *
  3267. * **Important note**: the `HTTP_TRANSFER_CACHE_ORIGIN_MAP` token should *only* be provided in
  3268. * the *server* code of your application (typically in the `app.server.config.ts` script). Angular throws an
  3269. * error if it detects that the token is defined while running on the client.
  3270. *
  3271. * @usageNotes
  3272. *
  3273. * When the same API endpoint is accessed via `http://internal-domain.com:8080` on the server and
  3274. * via `https://external-domain.com` on the client, you can use the following configuration:
  3275. * ```ts
  3276. * // in app.server.config.ts
  3277. * {
  3278. * provide: HTTP_TRANSFER_CACHE_ORIGIN_MAP,
  3279. * useValue: {
  3280. * 'http://internal-domain.com:8080': 'https://external-domain.com'
  3281. * }
  3282. * }
  3283. * ```
  3284. *
  3285. * @publicApi
  3286. */
  3287. declare const HTTP_TRANSFER_CACHE_ORIGIN_MAP: InjectionToken<Record<string, string>>;
  3288. /**
  3289. * Returns the DI providers needed to enable HTTP transfer cache.
  3290. *
  3291. * By default, when using server rendering, requests are performed twice: once on the server and
  3292. * other one on the browser.
  3293. *
  3294. * When these providers are added, requests performed on the server are cached and reused during the
  3295. * bootstrapping of the application in the browser thus avoiding duplicate requests and reducing
  3296. * load time.
  3297. *
  3298. */
  3299. declare function withHttpTransferCache(cacheOptions: HttpTransferCacheOptions): Provider[];
  3300. /**
  3301. * Uses `XMLHttpRequest` to send requests to a backend server.
  3302. * @see {@link HttpHandler}
  3303. * @see {@link JsonpClientBackend}
  3304. *
  3305. * @publicApi
  3306. */
  3307. declare class HttpXhrBackend implements HttpBackend {
  3308. private xhrFactory;
  3309. constructor(xhrFactory: XhrFactory);
  3310. /**
  3311. * Processes a request and returns a stream of response events.
  3312. * @param req The request object.
  3313. * @returns An observable of the response events.
  3314. */
  3315. handle(req: HttpRequest<any>): Observable<HttpEvent<any>>;
  3316. static ɵfac: i0.ɵɵFactoryDeclaration<HttpXhrBackend, never>;
  3317. static ɵprov: i0.ɵɵInjectableDeclaration<HttpXhrBackend>;
  3318. }
  3319. /**
  3320. * Retrieves the current XSRF token to use with the next outgoing request.
  3321. *
  3322. * @publicApi
  3323. */
  3324. declare abstract class HttpXsrfTokenExtractor {
  3325. /**
  3326. * Get the XSRF token to use with an outgoing request.
  3327. *
  3328. * Will be called for every request, so the token may change between requests.
  3329. */
  3330. abstract getToken(): string | null;
  3331. }
  3332. export { FetchBackend, HTTP_INTERCEPTORS, HTTP_TRANSFER_CACHE_ORIGIN_MAP, HttpBackend, HttpClient, HttpContext, HttpEvent, HttpFeatureKind, HttpHandler, HttpHeaders, HttpParams, HttpProgressEvent, HttpRequest, HttpResponse, HttpXhrBackend, HttpXsrfTokenExtractor, JsonpClientBackend, JsonpInterceptor, httpResource, provideHttpClient, withFetch, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXsrfConfiguration, HTTP_ROOT_INTERCEPTOR_FNS as ɵHTTP_ROOT_INTERCEPTOR_FNS, HttpInterceptorHandler as ɵHttpInterceptingHandler, HttpInterceptorHandler as ɵHttpInterceptorHandler, REQUESTS_CONTRIBUTE_TO_STABILITY as ɵREQUESTS_CONTRIBUTE_TO_STABILITY, withHttpTransferCache as ɵwithHttpTransferCache };
  3333. export type { HttpFeature, HttpHandlerFn, HttpInterceptor, HttpInterceptorFn, HttpResourceFn, HttpResourceOptions, HttpResourceRef, HttpResourceRequest, HttpTransferCacheOptions };