Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 2.23 KB

File metadata and controls

56 lines (39 loc) · 2.23 KB

sindresorhus/ky Bootcamp

Tiny Fetch-based HTTP client with ergonomic helpers, retries, and hooks.

Ky is a small, dependency-free HTTP client built on the Fetch API for modern runtimes like browsers and Node.js. It adds method shortcuts, typed response helpers, retry and timeout handling, and hook-based lifecycle extensions. The source exports a factory that creates Ky instances with merged defaults and exposes helper symbols for retry control.

Quick Facts

Languages TypeScript
Frameworks None
Build System npm
Package Manager N/A

Prerequisites

  • Node.js >=18
  • npm

Quick Start

  1. Install dependencies: npm install
  2. Run tests and lint/build: npm test
  3. Build distribution output: npm run build
  4. If running browser-related tests, install Playwright browsers: npx playwright install --with-deps

Key commands: npm install, npm test, npm run build, npx playwright install --with-deps

Project Structure

  • source - Library TypeScript source and public exports.
  • source/core - Core request engine, retry, hooks, and response helpers.
  • source/errors - Error types thrown by the client.
  • source/utils - Shared helpers for merging options, normalization, and body/timeout handling.
  • source/types - Public TypeScript type definitions for options, hooks, and responses.

If You Only Have 30 Minutes

  1. Read this document
  2. Run the dev server: npm install
  3. Pick one of these starter tasks:
  • Document Node.js version requirement: Add a short prerequisite note in the Install section that Node.js >=18 is required, matching package.json engines.
  • Document ky.stop and ky.retry helpers: Add a brief README snippet showing how to stop retries in beforeRetry and how to trigger retries from afterResponse.
  • Test prefixUrl leading-slash validation: Add an AVA test that asserts ky throws when prefixUrl is used with an input starting with '/'.

Next Steps


Generated by Repo Bootcamp