New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tiny-post-json

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-post-json

Tiny wrapper around Fetch to POST JSON payloads to JSON APIs

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

tiny-post-json

NPM version Package size

Tiny wrapper around Fetch to POST JSON payloads to JSON APIs.

Requirements

  • Node.js 18+ (or any environment with fetch available)

Install

npm install tiny-post-json

Usage

const postJson = require("tiny-post-json");

const res = await postJson(
  "https://any.json.api",
  { data: "anything" },
  { headers: { Authorization: "Bearer TOKEN" } },
);
// `res` will be an object resulting from parsing the JSON response

API

postJson(resource, payload, options)

POSTs the payload as JSON to the given URL.

  • Throws an error if the request fails or the response is not 2xx.
  • Returns a Promise with the response parsed as JSON.

resource

Type: string | URL | Request
The resource to fetch, i.e. the URL.

payload

Type: unknown The payload to send to the API. It can be anything that can be stringified as JSON.

options

Type: RequestInit
Additional settings to apply to the request.

Keywords

api

FAQs

Package last updated on 30 Sep 2025

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