Skip to content

Latest commit

History

History
38 lines (26 loc) 路 725 Bytes

http-command.md

File metadata and controls

38 lines (26 loc) 路 725 Bytes

HttpCommand

An abstract class with a method to perform http requests with pre-defined headers using fetchDefaults.

Options

Type: object literal

Optional properties are denoted by *
headers*

Type: object literal

fetch?

Type: function
Default: node-fetch

Example

const { HttpCommand } = require("@abstracter/atomic-release/commands");

class ExampleHttpCommand extends HttpCommand {
  async do() {
    await this.fetch("https://api.github.com", {
      method: "HEAD",
    });
  }
}

const command = new ExampleHttpCommand({
  headers: {
    'X-Custom-Header': "This header will be part of the request headers",
  },
});