httpHeaders.d.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * An individual header within a HttpHeaders collection.
  3. */
  4. export interface HttpHeader {
  5. /**
  6. * The name of the header.
  7. */
  8. name: string;
  9. /**
  10. * The value of the header.
  11. */
  12. value: string;
  13. }
  14. /**
  15. * A HttpHeaders collection represented as a simple JSON object.
  16. */
  17. export declare type RawHttpHeaders = {
  18. [headerName: string]: string;
  19. };
  20. /**
  21. * A collection of HTTP header key/value pairs.
  22. */
  23. export declare class HttpHeaders {
  24. private readonly _headersMap;
  25. constructor(rawHeaders?: RawHttpHeaders);
  26. /**
  27. * Set a header in this collection with the provided name and value. The name is
  28. * case-insensitive.
  29. * @param headerName The name of the header to set. This value is case-insensitive.
  30. * @param headerValue The value of the header to set.
  31. */
  32. set(headerName: string, headerValue: string | number): void;
  33. /**
  34. * Get the header value for the provided header name, or undefined if no header exists in this
  35. * collection with the provided name.
  36. * @param headerName The name of the header.
  37. */
  38. get(headerName: string): string | undefined;
  39. /**
  40. * Get whether or not this header collection contains a header entry for the provided header name.
  41. */
  42. contains(headerName: string): boolean;
  43. /**
  44. * Remove the header with the provided headerName. Return whether or not the header existed and
  45. * was removed.
  46. * @param headerName The name of the header to remove.
  47. */
  48. remove(headerName: string): boolean;
  49. /**
  50. * Get the headers that are contained this collection as an object.
  51. */
  52. rawHeaders(): RawHttpHeaders;
  53. /**
  54. * Get the headers that are contained in this collection as an array.
  55. */
  56. headersArray(): HttpHeader[];
  57. /**
  58. * Get the header names that are contained in this collection.
  59. */
  60. headerNames(): string[];
  61. /**
  62. * Get the header names that are contained in this collection.
  63. */
  64. headerValues(): string[];
  65. /**
  66. * Get the JSON object representation of this HTTP header collection.
  67. */
  68. toJson(): RawHttpHeaders;
  69. /**
  70. * Get the string representation of this HTTP header collection.
  71. */
  72. toString(): string;
  73. /**
  74. * Create a deep clone/copy of this HttpHeaders collection.
  75. */
  76. clone(): HttpHeaders;
  77. }
  78. //# sourceMappingURL=httpHeaders.d.ts.map