This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

interface Headers {
    append(name: string, value: string): void;
    delete(name: string): void;
    forEach(callbackfn: ((value: string, key: string, parent: Headers) => void), thisArg?: any): void;
    get(name: string): null | string;
    has(name: string): boolean;
    set(name: string, value: string): void;
}

方法

  • 参数

    • name: string
    • value: string

    返回 void

  • 参数

    • name: string

    返回 void

  • 参数

    • callbackfn: ((value: string, key: string, parent: Headers) => void)
        • (value, key, parent): void
        • 参数

          • value: string
          • key: string
          • parent: Headers

          返回 void

    • 可选thisArg: any

    返回 void

  • 参数

    • name: string

    返回 null | string

  • 参数

    • name: string

    返回 boolean

  • 参数

    • name: string
    • value: string

    返回 void