Socket
Socket
Sign inDemoInstall

got

Package Overview
Dependencies
Maintainers
1
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

got - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

20

index.js

@@ -5,10 +5,20 @@ 'use strict';

var https = require('https');
var assign = require('object-assign');
module.exports = function (url, cb) {
module.exports = function (url, opts, cb) {
var redirectCount = 0;
var get = function (url, cb) {
var fn = urlLib.parse(url).protocol === 'https:' ? https : http;
var get = function (url, opts, cb) {
if (typeof opts === 'function') {
cb = opts;
opts = {};
}
fn.get(url, function (res) {
cb = cb || function () {};
var parsedUrl = urlLib.parse(url);
var fn = parsedUrl.protocol === 'https:' ? https : http;
var arg = assign({}, parsedUrl, opts);
fn.get(arg, function (res) {
var ret = '';

@@ -47,3 +57,3 @@

get(url, cb);
get(url, opts, cb);
};
{
"name": "got",
"version": "0.1.1",
"description": "Simplified HTTP/HTTPS GET requests",
"version": "0.2.0",
"description": "Simplified HTTP/HTTPS requests",
"license": "MIT",

@@ -33,2 +33,5 @@ "repository": "sindresorhus/got",

],
"dependencies": {
"object-assign": "^0.3.0"
},
"devDependencies": {

@@ -35,0 +38,0 @@ "mocha": "*"

# got [![Build Status](https://travis-ci.org/sindresorhus/got.svg?branch=master)](https://travis-ci.org/sindresorhus/got)
> Simplified HTTP/HTTPS GET requests
> Simplified HTTP/HTTPS requests
Follows redirects. Not intended to be feature-rich. Use [request](https://github.com/mikeal/request) if you need something more.
A nicer interface to the built-in [`http`](http://nodejs.org/api/http.html) module that also follows redirects. Use [request](https://github.com/mikeal/request) if you need more.

@@ -27,4 +27,26 @@

### API
It's a `GET` request by default, but can be changed in `options`.
#### got(url, [options], [callback])
##### url
*Required*
Type: `string`
The url to request.
##### options
Type: `object`
Any of the [`http.request`](http://nodejs.org/api/http.html#http_http_request_options_callback) options.
##### callback(err, data)
## License
[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com)
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