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

unirest

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unirest - npm Package Compare versions

Comparing version 0.3.7 to 0.3.8

6

index.js

@@ -664,3 +664,7 @@ /**

if (is(value).a(Object)) {
return Unirest.serializers.json(value)
if (value instanceof fs.FileReadStream) {
return value;
} else {
return Unirest.serializers.json(value)
}
} else {

@@ -667,0 +671,0 @@ return value.toString();

2

package.json
{
"name": "unirest",
"version": "0.3.7",
"version": "0.3.8",
"description": "Simple HTTP Request client.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,3 +0,8 @@

# Unirest for Node.js [![Build Status](http://img.shields.io/travis/Mashape/unirest-nodejs/master.svg)](https://travis-ci.org/Mashape/unirest-nodejs) [![NPM Version](http://img.shields.io/npm/v/unirest.svg)](https://www.npmjs.com/package/unirest)
# Unirest for Node.js [![Build Status](http://img.shields.io/travis/Mashape/unirest-nodejs/master.svg?style=flat)](https://travis-ci.org/Mashape/unirest-nodejs) [![NPM Version](https://badge.fury.io/js/unirest.svg)](https://www.npmjs.com/package/unirest)
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/Mashape/unirest-nodejs/master/LICENSE)
[![Downloads](https://img.shields.io/npm/dm/unirest.svg?style=flat)](https://www.npmjs.com/package/unirest)
![David](https://img.shields.io/david/mashape/unirest-nodejs.svg)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Mashape/unirest-php?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Unirest is a set of lightweight HTTP clients available in multiple languages.

@@ -326,3 +331,3 @@

'file': 'dog.png',
'relative file': fs.createReadStream(path.join(__dirname, 'dog.png'),
'relative file': fs.createReadStream(path.join(__dirname, 'dog.png')),
'remote file': unirest.request('http://google.com/doodle.png')

@@ -342,3 +347,3 @@ })

.attach('file', 'dog.png') // Attachment
.attach('remote file', fs.createReadStream(path.join(__dirname, 'dog.png')) // Same as above.
.attach('remote file', fs.createReadStream(path.join(__dirname, 'dog.png'))) // Same as above.
.attach('remote file', unirest.request('http://google.com/doodle.png'))

@@ -726,1 +731,13 @@ .end(function (response) {

```
## License
Licensed under the MIT license.
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

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

var fs = require("fs");
var should = require("should");

@@ -145,2 +146,24 @@ var unirest = require('../index');

it('should correctly post MULTIFORM data using fs.createReadStream.', function (done) {
var request = unirest.post('http://httpbin.org/post');
var file = __dirname + '/../README.md';
var data = {
a: 'foo',
b: 'bar',
c: undefined
};
request.attach({'u': fs.createReadStream(file)});
for (var key in data) {
request.field(key, data[key]);
}
request.end(function (response) {
should(response.status).equal(200);
should(response.body.headers['Content-Type']).startWith('multipart/form-data');
done();
});
});
it('should correctly post MULTIFORM data with port number', function (done) {

@@ -147,0 +170,0 @@ var request = unirest.post('http://httpbin.org:80/post');

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