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

needle

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

needle - npm Package Compare versions

Comparing version 0.6.3 to 0.6.4

README.md~

38

lib/needle.js

@@ -42,10 +42,14 @@ //////////////////////////////////////////

'application/json': function(data, callback) {
var err, str = data;
try {
callback(null, data && JSON.parse(data));
str = JSON.parse(data);
} catch(e) {
callback(e, data);
err = e;
}
callback(err, data);
}
};
parsers['text/javascript'] = parsers['application/json'];
try {

@@ -323,3 +327,3 @@ var xml2js = require('xml2js');

// if there's a parser for the content type received, process it
if (opts.parse && parsers[opts.content_type]) {
if (opts.parse && typeof parsers[opts.content_type] == 'function') {
parsers[opts.content_type](resp.body.toString(), handle_output);

@@ -348,24 +352,16 @@ } else {

exports.head = function(uri, options, callback) {
return Needle.request('HEAD', uri, null, options, callback);
}
'head get'.split(' ').forEach(function(method) {
exports[method] = function(uri, options, callback) {
return Needle.request(method, uri, null, options, callback);
}
})
exports.get = function(uri, options, callback) {
return Needle.request('GET', uri, null, options, callback);
}
'post put delete'.split(' ').forEach(function(method) {
exports[method] = function(uri, data, options, callback) {
return Needle.request(method, uri, data, options, callback);
}
})
exports.post = function(uri, data, options, callback) {
return Needle.request('POST', uri, data, options, callback);
}
exports.put = function(uri, data, options, callback) {
return Needle.request('PUT', uri, data, options, callback);
}
exports.delete = function(uri, data, options, callback) {
return Needle.request('DELETE', uri, data, options, callback);
}
exports.request = function(method, uri, data, opts, callback) {
return Needle.request(method.toUpperCase(), uri, data, opts, callback);
};
{
"name": "needle"
, "version": "0.6.3"
, "version": "0.6.4"
, "description": "Tiny yet feature-packed HTTP client. With multipart, charset decoding and proxy support."

@@ -5,0 +5,0 @@ , "keywords": ["http", "https", "simple", "request", "client", "multipart", "upload", "proxy", "deflate", "timeout", "charset", "iconv"]

Needle
======
[![NPM](https://nodei.co/npm/needle.png)](https://nodei.co/npm/needle/)
The leanest and most handsome HTTP client in the Nodelands. With only two dependencies, it supports:

@@ -5,0 +8,0 @@

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