Socket
Socket
Sign inDemoInstall

got

Package Overview
Dependencies
21
Maintainers
2
Versions
175
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.4.0 to 2.5.0

6

index.js

@@ -68,2 +68,6 @@ 'use strict';

if (proxy) {
proxy.emit('response', res);
}
// redirect

@@ -104,3 +108,3 @@ if (status.redirect[statusCode] && 'location' in res.headers) {

read(res, encoding, function (err, data) {
cb.call(null, err, data, response);
cb.call(null, err, data, response);
});

@@ -107,0 +111,0 @@ }).once('error', cb);

2

package.json
{
"name": "got",
"version": "2.4.0",
"version": "2.5.0",
"description": "Simplified HTTP/HTTPS requests",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -9,3 +9,3 @@ # got [![Build Status](https://travis-ci.org/sindresorhus/got.svg?branch=master)](https://travis-ci.org/sindresorhus/got)

Use [request](https://github.com/mikeal/request) if you need more.
Created because [`request`](https://github.com/mikeal/request) is bloated *(several megabytes!)* and slow.

@@ -103,2 +103,10 @@

##### .on('response', response)
When in stream mode, you can listen for the `response` event to get the response object.
###### response
The [response object](http://nodejs.org/api/http.html#http_http_incomingmessage).
#### got.get(url, [options], [callback])

@@ -128,8 +136,23 @@ #### got.post(url, [options], [callback])

})
}, function (err, data, res) {});
}, function () {});
```
## Tip
It's a good idea to set the `'user-agent'` header so the provider can more easily see how their resource is used. By default it's the URL to this repo.
```js
var got = require('got');
got('todomvc.com', {
headers: {
'user-agent': 'https://github.com/your-username/repo-name'
}
}, function () {});
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc