Socket
Socket
Sign inDemoInstall

is-json-request

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-json-request

Check if the current request is json, express js, next js, any node js server side code.


Version published
Weekly downloads
6
decreased by-25%
Maintainers
1
Install size
13.6 kB
Created
Weekly downloads
 

Changelog

Source

1.0.1 (2023-12-10)

Bug Fixes

  • fix isJsonReq function to handle map headers object that is used in Next.JS (451008e)

Features

  • first release: first release (c8042d8)

Readme

Source

is-json-request

Build Status

Check if the current request is json, express js, next js, any node js server side code. (supports module and commonJS).

https://shadiabuhilal.github.io/is-json-request/


Usage

import is-json-request

import { isJsonReq, isGetReq, isPostReq, isPutReq, isDeleteReq } from 'is-json-request';

Or

require is-json-request

const { isJsonReq, isGetReq, isPostReq, isPutReq, isDeleteReq } = require('is-json-request');

isJsonReq

This function checks if the current request is a json request or not.

Example:

if (isJsonReq(req)) {
  // Is a JSON request
}

isGetReq

This function checks if the current request is a http GET method request or not.

Example:

if (isGetReq(req)) {
  // Is a HTTP GET method request
}

isPostReq

This function checks if the current request is a http POST method request or not.

Example:

if (isPostReq(req)) {
  // Is a HTTP POST method request
}

isPutReq

This function checks if the current request is a http PUT method request or not.

Example:

if (isPutReq(req)) {
  // Is a HTTP PUT method request
}

isDeleteReq

This function checks if the current request is a http DELETE method request or not.

Example:

if (isDeleteReq(req)) {
  // Is a HTTP DELETE method request
}

Keywords

FAQs

Last updated on 10 Dec 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc