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

bluereq

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluereq - npm Package Compare versions

Comparing version 2.1.7 to 2.1.8

4

lib/get_options.js

@@ -14,3 +14,5 @@ const signature = require('./signature_checker')

opts.config = args[0]
if (opts.config.json == null) opts.config.json = true
if (opts.config.json == null && hasData) {
opts.config.json = opts.config.body != null && typeof opts.config.body === 'object'
}

@@ -17,0 +19,0 @@ // post(url, json) or put(url, json)

{
"name": "bluereq",
"version": "2.1.7",
"version": "2.1.8",
"description": "A bluebird promise wrapper for HTTP requests",

@@ -17,2 +17,3 @@ "main": "lib/bluereq.js",

"body-parser": "^1.18.2",
"doctoc": "^1.4.0",
"express": "^4.16.3",

@@ -26,5 +27,6 @@ "git-hooks": "^1.1.10",

"scripts": {
"lint": "standard",
"prepublishOnly": "npm run lint && npm test",
"test": "mocha tests/unit/* tests/feature/*",
"lint": "standard",
"prepublishOnly": "npm run lint && npm test"
"update-toc": "doctoc README.md"
},

@@ -31,0 +33,0 @@ "repository": {

@@ -1,2 +0,2 @@

# Bluereq
# bluereq

@@ -6,3 +6,19 @@ **simple HTTP requests for promises lovers**

# Installation
## Summary
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
- [Installation](#installation)
- [How-to](#how-to)
- [the simple way](#the-simple-way)
- [the more configurable way](#the-more-configurable-way)
- [debug](#debug)
- [Alternatives](#alternatives)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Installation
```sh

@@ -12,3 +28,3 @@ npm install bluereq

# How-to
## How-to

@@ -19,3 +35,3 @@ ```javascript

## the simple way
### the simple way

@@ -39,3 +55,3 @@ * **GET** / **HEAD** / **DELETE**

## the more configurable way
### the more configurable way
Take advantage of [request](https://www.npmjs.com/package/request) configurability to customize your request

@@ -67,5 +83,10 @@

### debug
As it is using [request](https://www.npmjs.com/package/request) under the hood, you can get debug it [the same way](https://github.com/request/request#debugging):
```sh
export NODE_DEBUG=request ; node script.js
```
# Alternatives
## Alternatives
I started this lib as a simple fork of qreq, not seeing that [a lot was already happening to wrap request and bluebird together](https://libraries.io/search?q=request+bluebird&platforms=NPM&sort=stars), especially [request-promise](https://github.com/request/request-promise) seems interesting, (while slightly more bloted ;) )

@@ -17,2 +17,3 @@ const should = require('should')

.catch(err => {
should(err.url).equal(invalidConfig.url)
should(err.statusCode).equal(expectedErr.statusCode)

@@ -19,0 +20,0 @@ should(err.body).deepEqual(expectedErr.body)

@@ -7,3 +7,3 @@ const should = require('should')

describe('[url]', () => {
it('returns a valid options object', () => {
it('should return a valid options object', () => {
const args = ['http://example.dev']

@@ -16,3 +16,3 @@ should(getOpts(args).config).deepEqual({ url: 'http://example.dev', json: true, gzip: true })

describe('[config]', () => {
it('returns a valid options object', () => {
it('should return a valid options object', () => {
const args = [{ url: 'http://example.dev' }]

@@ -27,11 +27,17 @@ const opts = getOpts(args)

const args = ['http://example.dev', { message: 'JSON data' }]
describe('if "hasData" is true', () => {
it('returns a valid options object', () => {
const opts = getOpts(args, true)
should(opts.config).deepEqual({ url: args[0], json: args[1], gzip: true })
should(opts.callback).not.be.ok()
})
it('should return a valid options object', () => {
const opts = getOpts(args, true)
should(opts.config).deepEqual({ url: args[0], json: args[1], gzip: true })
should(opts.callback).not.be.ok()
})
})
describe('[url, string data]', () => {
const args = ['http://example.dev', 'string data']
it('should return without json option', () => {
const opts = getOpts(args, true)
should(opts.config).deepEqual({ url: args[0], body: args[1], gzip: true })
})
})
})
})

Sorry, the diff of this file is not supported yet

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