httpOperationResponse.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /// <reference types="node" />
  2. import { WebResource } from "./webResource";
  3. import { HttpHeaders } from "./httpHeaders";
  4. /**
  5. * The properties on an HTTP response which will always be present.
  6. */
  7. export interface HttpResponse {
  8. /**
  9. * The raw request
  10. */
  11. request: WebResource;
  12. /**
  13. * The HTTP response status (e.g. 200)
  14. */
  15. status: number;
  16. /**
  17. * The HTTP response headers.
  18. */
  19. headers: HttpHeaders;
  20. }
  21. declare global {
  22. /**
  23. * Stub declaration of the browser-only Blob type.
  24. * Full type information can be obtained by including "lib": ["dom"] in tsconfig.json.
  25. */
  26. interface Blob {
  27. }
  28. }
  29. /**
  30. * Wrapper object for http request and response. Deserialized object is stored in
  31. * the `parsedBody` property when the response body is received in JSON or XML.
  32. */
  33. export interface HttpOperationResponse extends HttpResponse {
  34. /**
  35. * The parsed HTTP response headers.
  36. */
  37. parsedHeaders?: {
  38. [key: string]: any;
  39. };
  40. /**
  41. * The response body as text (string format)
  42. */
  43. bodyAsText?: string | null;
  44. /**
  45. * The response body as parsed JSON or XML
  46. */
  47. parsedBody?: any;
  48. /**
  49. * BROWSER ONLY
  50. *
  51. * The response body as a browser Blob.
  52. * Always undefined in node.js.
  53. */
  54. blobBody?: Promise<Blob>;
  55. /**
  56. * NODEJS ONLY
  57. *
  58. * The response body as a node.js Readable stream.
  59. * Always undefined in the browser.
  60. */
  61. readableStreamBody?: NodeJS.ReadableStream;
  62. }
  63. /**
  64. * The flattened response to a REST call.
  65. * Contains the underlying HttpOperationResponse as well as
  66. * the merged properties of the parsedBody, parsedHeaders, etc.
  67. */
  68. export interface RestResponse {
  69. /**
  70. * The underlying HTTP response containing both raw and deserialized response data.
  71. */
  72. _response: HttpOperationResponse;
  73. [key: string]: any;
  74. }
  75. //# sourceMappingURL=httpOperationResponse.d.ts.map