Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@rojiwon123/fetch

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@rojiwon123/fetch

Fetch API wrapped around the original fetch function

unpublished
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

Fetch API

npm version Downloads Release 🔖

Fetch API wrapped around the original fetch function

Installation

npm i @rojiwon123/fetch

Example

import fetch from "@rojiwon123/fetch";

void fetch.request
    .query({ url: "http://localhost:3000", method: "GET" })
    .then(fetch.response.match({ 200: fetch.response.none() }))
    .then(console.log); // null

// request headers content-type value is `application/json; charset=utf-8`
void fetch.request
    .json({
        url: "http://localhost:3000",
        body: { test: "test" },
        method: "POST",
    })
    .then(
        fetch.response.match({
            201: fetch.response.json((i) => i), // status 201 case
            _: fetch.response.text((i) => i), // default case
        }),
    )
    .then(console.log); // log response body

Keywords

fetch

FAQs

Package last updated on 21 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts