Comparing version 3.2.0 to 4.0.0
@@ -23,3 +23,2 @@ "use strict"; | ||
const is_stream_1 = __importDefault(require("is-stream")); | ||
const url_1 = __importDefault(require("url")); | ||
const common_1 = require("./common"); | ||
@@ -29,3 +28,2 @@ const retry_1 = require("./retry"); | ||
/* eslint-disable node/no-unsupported-features/node-builtins */ | ||
const URL = hasURL() ? window.URL : url_1.default.URL; | ||
const fetch = hasFetch() ? window.fetch : node_fetch_1.default; | ||
@@ -35,5 +33,2 @@ function hasWindow() { | ||
} | ||
function hasURL() { | ||
return hasWindow() && !!window.URL; | ||
} | ||
function hasFetch() { | ||
@@ -143,11 +138,11 @@ return hasWindow() && !!window.fetch; | ||
} | ||
const parsedUrl = new URL(opts.url); | ||
opts.url = `${parsedUrl.origin}${parsedUrl.pathname}`; | ||
opts.params = extend_1.default(querystring_1.default.parse(parsedUrl.search.substr(1)), // removes leading ? | ||
opts.params); | ||
opts.paramsSerializer = opts.paramsSerializer || this.paramsSerializer; | ||
if (opts.params) { | ||
parsedUrl.search = opts.paramsSerializer(opts.params); | ||
let additionalQueryParams = opts.paramsSerializer(opts.params); | ||
if (additionalQueryParams.startsWith('?')) { | ||
additionalQueryParams = additionalQueryParams.slice(1); | ||
} | ||
const prefix = opts.url.includes('?') ? '&' : '?'; | ||
opts.url = opts.url + prefix + additionalQueryParams; | ||
} | ||
opts.url = parsedUrl.href; | ||
if (typeof options.maxContentLength === 'number') { | ||
@@ -154,0 +149,0 @@ opts.size = options.maxContentLength; |
# Changelog | ||
## [4.0.0](https://www.github.com/googleapis/gaxios/compare/v3.2.0...v4.0.0) (2020-10-21) | ||
### ⚠ BREAKING CHANGES | ||
* parameters in `url` and parameters provided via params will now be combined. | ||
### Bug Fixes | ||
* drop requirement on URL/combine url and params ([#338](https://www.github.com/googleapis/gaxios/issues/338)) ([e166bc6](https://www.github.com/googleapis/gaxios/commit/e166bc6721fd979070ab3d9c69b71ffe9ee061c7)) | ||
## [3.2.0](https://www.github.com/googleapis/gaxios/compare/v3.1.0...v3.2.0) (2020-09-14) | ||
@@ -4,0 +15,0 @@ |
{ | ||
"name": "gaxios", | ||
"version": "3.2.0", | ||
"version": "4.0.0", | ||
"description": "A simple common HTTP client specifically for Google APIs and services.", | ||
@@ -65,3 +65,3 @@ "main": "build/src/index.js", | ||
"express": "^4.16.4", | ||
"gts": "^2.0.0", | ||
"gts": "^3.0.0", | ||
"is-docker": "^2.0.0", | ||
@@ -71,3 +71,3 @@ "karma": "^5.0.0", | ||
"karma-coverage": "^2.0.0", | ||
"karma-firefox-launcher": "^1.1.0", | ||
"karma-firefox-launcher": "^2.0.0", | ||
"karma-mocha": "^2.0.0", | ||
@@ -91,3 +91,3 @@ "karma-remap-coverage": "^0.1.5", | ||
"webpack": "^4.29.5", | ||
"webpack-cli": "^3.2.3" | ||
"webpack-cli": "^4.0.0" | ||
}, | ||
@@ -94,0 +94,0 @@ "dependencies": { |
@@ -53,3 +53,10 @@ # gaxios | ||
// The data to send in the body of the request. Data objects will be serialized as JSON. | ||
// The data to send in the body of the request. Data objects will be | ||
// serialized as JSON. | ||
// | ||
// Note: if you would like to provide a Content-Type header other than | ||
// application/json you you must provide a string or readable stream, rather | ||
// than an object: | ||
// data: JSON.stringify({some: 'data'}) | ||
// data: fs.readFile('./some-data.jpeg') | ||
data: { | ||
@@ -56,0 +63,0 @@ some: 'data' |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58172
152
583