8000 GitHub - mastondzn/netter: Small and ergonomic HTTP client that wraps the Fetch API.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mastondzn/netter

Repository files navigation

Netter

Netter is a small (~2kB) and ergonomic HTTP client that wraps the Fetch API, providing a more convenient interface for making HTTP requests.

Installation

pnpm add netter

Usage

import { netter } from 'netter';

const response = await netter.post('https://jsonplaceholder.typicode.com/posts', {
    json: { title: 'foo', body: 'bar', userId: 1 },
});

const data = await netter('https://jsonplaceholder.typicode.com/posts/1').json();
// typeof data is unknown

const data = await netter('https://jsonplaceholder.typicode.com/posts/1', {
    parse: (data) => z.object({ id: z.number() }).parse(data),
}).json();
// typeof data is now { id: number }!

About

Small and ergonomic HTTP client that wraps the Fetch API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0