New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

httpquest

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpquest

Wrapper to simplify the fetch API

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

httpquest

A wrapper to simplify the fetch API.

Installation

npm install httpquest

Reference

  • httpRequest
  • get
  • post
  • put
  • patch
  • delete

httpRequest

Syntax:

import httpRequest from 'httpquest';

httpRequest(url, method, body, options)
.then(json => console.log(json))
.catch(error => console.error(error));
url

Type: String

A string representing the URL of the request.

method

Type: String

A case-insensitive string representing the method of the request.

  • 'HEAD'
  • 'GET'
  • 'POST'
  • 'PUT'
  • 'PATCH'
  • 'DELETE'
body (depending on method, optional)

Type: Object

An object of either FormData or JSON required for only POST, PUT and PATCH requests which contain the payload data.

options (optional)

Type: Object

An object that contains other paremeters that the Fetch API accepts.

Example:

{
  credentials: 'include',
  headers: { xsrfToken: token },
  params: { search: 'dog' }
}

get

Syntax:

import { get } from 'httpquest';

get(url, options)
.then(json => console.log(json))
.catch(error => console.error(error));
url

Type: String

A string representing the URL of the request.

options (optional)

Type: Object

An object that contains other paremeters that the Fetch API accepts.

Example:

{
  credentials: 'include',
  headers: { xsrfToken: token },
  params: { search: 'dog' }
}

post

Syntax:

import { post } from 'httpquest';

post(url, body, options)
.then(json => console.log(json))
.catch(error => console.error(error));
url

Type: String

A string representing the URL of the request.

body (depending on method, optional)

Type: Object

An object of either FormData or JSON required for only POST, PUT and PATCH requests which contain the payload data.

options (optional)

Type: Object

An object that contains other paremeters that the Fetch API accepts.

Example:

{
  credentials: 'include',
  headers: { xsrfToken: token },
  params: { search: 'dog' }
}

put

Syntax:

import { put } from 'httpquest';

put(url, body, options)
.then(json => console.log(json))
.catch(error => console.error(error));
url

Type: String

A string representing the URL of the request.

body (depending on method, optional)

Type: Object

An object of either FormData or JSON required for only POST, PUT and PATCH requests which contain the payload data.

options (optional)

Type: Object

An object that contains other paremeters that the Fetch API accepts.

Example:

{
  credentials: 'include',
  headers: { xsrfToken: token },
  params: { search: 'dog' }
}

patch

Syntax:

import { patch } from 'httpquest';

patch(url, body, options)
.then(json => console.log(json))
.catch(error => console.error(error));
url

Type: String

A string representing the URL of the request.

body (depending on method, optional)

Type: Object

An object of either FormData or JSON required for only POST, PUT and PATCH requests which contain the payload data.

options (optional)

Type: Object

An object that contains other paremeters that the Fetch API accepts.

Example:

{
  credentials: 'include',
  headers: { xsrfToken: token },
  params: { search: 'dog' }
}

delete

Syntax:

import { delete } from 'httpquest';

delete(url, options)
.then(json => console.log(json))
.catch(error => console.error(error));
url

Type: String

A string representing the URL of the request.

body (depending on method, optional)

Type: Object

An object of either FormData or JSON required for only POST, PUT and PATCH requests which contain the payload data.

options (optional)

Type: Object

An object that contains other paremeters that the Fetch API accepts.

Example:

{
  credentials: 'include',
  headers: { xsrfToken: token },
  params: { search: 'dog' }
}

Keywords

FAQs

Package last updated on 29 Oct 2017

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc