Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@aravindhasamy/apihandler

The apiRequest function is a flexible utility designed to handle HTTP requests of various types, including GET, POST, PATCH, and DELETE. It supports making API calls to external services, handling different response types, and customizing request headers

API Request, HTTP methods (GET, POST, PATCH, DELETE), File handling (images, PDF), Error handling, Authorization, Authorization header (Bearer token), Custom header, Request Body (POST, PATCH), Query parameters, Fetch API, Fetch request, Content-Type header, Accept header, Cache-control, No-cache, Structured error messages, Buffer handling, Network errors, Flexible API utility

readme

@aravindhasamy/apihandler

@aravindhasamy/apihandler is a flexible utility to handle HTTP requests of various types, including GET, POST, PATCH, and DELETE. It supports making API calls to external services, handling different response types, and customizing request headers and body content.

Description

The apiRequest function within this package can be used for:

  • Sending HTTP requests of various methods (GET, POST, PATCH, DELETE).
  • Handling headers like Authorization (Bearer token), custom headers, and Content-Type.
  • Sending request bodies for POST and PATCH methods.
  • Handling query parameters, network errors, and structured error messages.

Features

  • Supports HTTP methods: GET, POST, PATCH, DELETE
  • Flexible API calls: Includes handling Authorization headers, custom headers, content-type headers, and request bodies.
  • Error Handling: Provides structured error messages for network errors.
  • File Handling: Handle content like images, PDFs, etc.

Installation

You can install the @aravindhasamy/apihandler package using npm:

npm install @aravindhasamy/apihandler