gaxios
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -25,3 +25,3 @@ "use strict"; | ||
const node_fetch_1 = require("node-fetch"); | ||
const qs = require("qs"); | ||
const qs = require("querystring"); | ||
const url_1 = require("url"); | ||
@@ -53,3 +53,3 @@ const common_1 = require("./common"); | ||
if (!opts.validateStatus(res.status)) { | ||
throw new common_1.GaxiosError(data, opts, translatedResponse); | ||
throw new common_1.GaxiosError(`Request failed with status code ${res.status}`, opts, translatedResponse); | ||
} | ||
@@ -114,3 +114,8 @@ return this.translateResponse(opts, res, data); | ||
} | ||
opts.body = opts.data; | ||
opts.headers = opts.headers || {}; | ||
if (opts.data) { | ||
opts.body = JSON.stringify(opts.data); | ||
opts.headers['Content-Type'] = 'application/json'; | ||
delete opts.data; | ||
} | ||
opts.validateStatus = opts.validateStatus || this.validateStatus; | ||
@@ -117,0 +122,0 @@ opts.responseType = opts.responseType || 'json'; |
{ | ||
"name": "gaxios", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A simple common HTTP client specifically for Google APIs and services.", | ||
@@ -33,3 +33,2 @@ "main": "build/src/index.js", | ||
"@types/node-fetch": "^2.1.2", | ||
"@types/qs": "^6.5.1", | ||
"assert-rejects": "^1.0.0", | ||
@@ -48,4 +47,3 @@ "codecov": "^3.0.4", | ||
"https-proxy-agent": "^2.2.1", | ||
"node-fetch": "^2.2.0", | ||
"qs": "^6.5.2" | ||
"node-fetch": "^2.2.0" | ||
}, | ||
@@ -52,0 +50,0 @@ "nyc": { |
Sorry, the diff of this file is not supported yet
42392
3
14
477
- Removedqs@^6.5.2
- Removedcall-bind@1.0.7(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhasown@2.0.2(transitive)
- Removedobject-inspect@1.13.2(transitive)
- Removedqs@6.12.2(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedside-channel@1.0.6(transitive)