Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

callarest

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

callarest

An http request library for node

latest
Source
npmnpm
Version
3.0.0
Version published
Maintainers
1
Created
Source

Callarest

A simple tool to natively make http(s) requests in node

Example Usage

Verbose

import { callarest } from 'callarest';

callarest({
  method: 'post',
  body: JSON.stringify({ hello: 'world' }),
  headers: {
    'Content-Type': 'application/json'
  },
  url: 'https://www.example.com'
}, function (error, rest) {
  if (error) {
    console.log('There was an error:', error);
  }
  console.log('The request was:', rest.request);
  console.log('The response was:', rest.response);
  console.log('The body was:', rest.body);

  // body will be a string
})

JSON

import { callarestJson } from 'callarest';

callarestJson({
  method: 'post',
  body: { hello: 'world' },
  url: 'https://www.example.com'
}, function (error, rest) {
  if (error) {
    console.log('There was an error:', error);
  }
  console.log('The request was:', rest.request);
  console.log('The response was:', rest.response);
  console.log('The body was:', rest.body);

  // body will be a javascript Object
})

License

This project is licensed under the terms of the MIT license.

Keywords

rest

FAQs

Package last updated on 08 Feb 2023

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