BarstoolSports / node-http-client

Http Client based on Undici

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-http-client

Http Client based on Undici

Install

{
  "dependencies": {
    "@barstoolsports/http-client": "BarstoolSports/node-http-client"
  }
}

Usage

Basic Request

import { httpClient } from '@barstoolsports/http-client'

const res = await httpClient.get('https://union.barstoolsports.com/status')
const json = await res.body.json()

Default Options

import { HttpClient } from '@barstoolsports/http-client'

const httpClient = new HttpClient({
  basePath: 'https://union.barstoolsports.com',
  headers: {
    authorization: 'bearer abcdef'
  }
})

const res = await httpClient.get('user/me')
const json = await res.body.json()

About

Http Client based on Undici


Languages

Language:TypeScript 100.0%