Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

request-with-cookies

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

request-with-cookies

An enhancement to mikeal/request library to create reusuable clients that supports cookies per client

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
119
decreased by-28.31%
Maintainers
1
Weekly downloads
 
Created
Source

request-with-cookies

NPM

Build Status

An enhancement to mikeal/request library to create reusuable clients that supports cookies per client

Usage

Create a new client and use the same API as mikeal/request

var request = require("request-with-cookies");
var client = request.createClient();
client("http://www.google.com", function (error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(body) // Prints the google web page.
  }
});

You can also create a client with baked in options

var request = require("request-with-cookies");
var options = {
  qs: {
    q: "foo"
  }
};

var client = request.createClient(options);
// now every request will be sent with "?q=foo" appended to the URL
client("http://www.google.com", function (error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(body) // Prints the google web page.
  }
});

Custom cookies can be set by passing in the following options

var options = {
  url: "https://foobar.com",
  cookies: [
  	{
  	  name: "foo",
  	  value: "v1"
  	},
  	{
  	  name: "bar",
  	  value: "v2"
  	}
  ]
};

Build and Test

The code can be built using gulp as follows

$ gulp 

Run tests using

$ npm test

Keywords

FAQs

Package last updated on 30 Mar 2015

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