Got HTTP Client

15.0.2 · active · verified Sat Apr 18

Got is a human-friendly and powerful HTTP request library for Node.js, currently at v15.0.2. It provides a modern Promise-based API for making HTTP requests, including features like retry mechanisms, hooks, and stream support. The library is actively maintained with frequent patch releases and major version updates that may introduce breaking changes, notably requiring Node.js 22+ and being ESM-only since v12 (reiterated in v15).

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates making a POST request with a JSON payload and receiving a JSON response using Got's dedicated JSON mode.

import got from 'got';

(async () => {
  try {
    const { data } = await got.post('https://httpbin.org/anything', {
      json: {
        hello: 'world'
      }
    }).json();

    console.log('Response data:', data);
    // Expected output: { "hello": "world" }
  } catch (error) {
    console.error('Request failed:', error);
  }
})();

view raw JSON →