codigo0/node_modules/happy-dom/lib/fetch/Headers.d.ts

95 lines
2.8 KiB
TypeScript
Raw Normal View History

import * as PropertySymbol from '../PropertySymbol.js';
import IHeadersInit from './types/IHeadersInit.js';
import BrowserWindow from '../window/BrowserWindow.js';
/**
* Fetch headers.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Headers
*/
export default class Headers {
protected [PropertySymbol.window]: BrowserWindow;
[PropertySymbol.entries]: {
[k: string]: {
name: string;
value: string[];
};
};
/**
* Constructor.
*
* @param init Headers init.
*/
constructor(init?: IHeadersInit | null);
/**
* Appends a new value onto an existing header inside a Headers object, or adds the header if it does not already exist.
*
* @param name Name.
* @param value Value.
*/
append(name: string, value: string): void;
/**
* Removes an header.
*
* @param name Name.
*/
delete(name: string): void;
/**
* Returns header value.
*
* @param name Name.
* @returns Value.
*/
get(name: string): string | null;
/**
* Sets a new value for an existing header inside a Headers object, or adds the header if it does not already exist.
*
* @param name Name.
* @param value Value.
*/
set(name: string, value: string): void;
/**
* Returns an array containing the values of all Set-Cookie headers associated with a response.
*
* @returns An array of strings representing the values of all the different Set-Cookie headers.
*/
getSetCookie(): string[];
/**
* Returns whether an Headers object contains a certain key.
*
* @param name Name.
* @returns "true" if the Headers object contains the key.
*/
has(name: string): boolean;
/**
* Executes a callback function once per each key/value pair in the Headers object.
*
* @param callback Callback.
* @param thisArg thisArg.
*/
forEach(callback: (value: string, name: string, parent: this) => void, thisArg?: any): void;
/**
* Returns an iterator, allowing you to go through all keys of the key/value pairs contained in this object.
*
* @returns Iterator.
*/
keys(): ArrayIterator<string>;
/**
* Returns an iterator, allowing you to go through all values of the key/value pairs contained in this object.
*
* @returns Iterator.
*/
values(): ArrayIterator<string>;
/**
* Returns an iterator, allowing you to go through all key/value pairs contained in this object.
*
* @returns Iterator.
*/
entries(): ArrayIterator<[string, string]>;
/**
* Iterator.
*
* @returns Iterator.
*/
[Symbol.iterator](): ArrayIterator<[string, string]>;
}
//# sourceMappingURL=Headers.d.ts.map