got 5.7.0 → 5.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +5 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -37,9 +37,6 @@ function requestAsEventEmitter(opts) {
37
37
  var req = fn.request(opts, function (res) {
38
38
  var statusCode = res.statusCode;
39
39
 
40
- res.url = redirectUrl || requestUrl;
41
- res.requestUrl = requestUrl;
42
-
43
40
  if (isRedirect(statusCode) && opts.followRedirect && 'location' in res.headers && (opts.method === 'GET' || opts.method === 'HEAD')) {
44
41
  res.resume();
45
42
 
@@ -59,7 +56,11 @@ function requestAsEventEmitter(opts) {
59
56
 
60
57
  // do not write ee.bind(...) instead of function - it will break gzip in Node.js 0.10
61
58
  setImmediate(function () {
62
- ee.emit('response', typeof unzipResponse === 'function' && req.method !== 'HEAD' ? unzipResponse(res) : res);
59
+ var response = typeof unzipResponse === 'function' && req.method !== 'HEAD' ? unzipResponse(res) : res;
60
+ response.url = redirectUrl || requestUrl;
61
+ response.requestUrl = requestUrl;
62
+
63
+ ee.emit('response', response);
63
64
  });
64
65
  });
65
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "got",
3
- "version": "5.7.0",
3
+ "version": "5.7.1",
4
4
  "description": "Simplified HTTP/HTTPS requests",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/got",