Skip to content

Jswk1/planck-http-fetch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

planck-http-fetch

Simple promise-based HTTP/HTTPS fetch.

Install

npm install planck-http-fetch

Use

import { Fetch } from "planck-http-fetch";

const data = await new Fetch("https://...", 1000) // url + timeout (if not set - 10s)
    .head("Api-Key", "123") // sets header
    .head("Host", "my.host.com")    // sets another header
    .basicAuth("user", "password")  // enables basic auth in HTTP header
    .unauthorized() // skips certificate check if https
    .fetch("data to send", "text/plain");   // do request with data and content type

For fetch method:

If data is set POST is used, else GET

If contentType is not set, application/json;charset=utf-8 is used

About

Simple http/https fetch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%