1.3.1 • Published 11 months ago

@shikaan/http-client v1.3.1

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

HTTP Client

Simple, opinionated, and dependency free HTTP client for the browser.

Features

  • Retries
  • Timeout
  • JSON based
  • Throws on non 2xx status codes

Installation

npm i -E @shikaan/http-client

Usage

import {BaseHTTPClient} from 'http-client';

export class APIClient extends BaseHTTPClient {
  constructor(token?: string) {
    super();
    this.token = token;
  }

  async queryUsers() {
    const [body, headers] = await this.fetch(`${BASE_URL}/users`, {timeout: 3000, maxRetries: 3});

    return body.data;
  }
}

export const apiClient = new APIClient();
1.2.0

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.3.1

11 months ago

1.3.0

11 months ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.0

3 years ago