Comparing version 1.1.1 to 1.2.0
@@ -32,2 +32,5 @@ /// <reference types="node" /> | ||
params?: any; | ||
paramsSerializer?: (params: { | ||
[index: string]: string | number; | ||
}) => string; | ||
timeout?: number; | ||
@@ -34,0 +37,0 @@ responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'stream'; |
@@ -29,3 +29,8 @@ import { GaxiosOptions, GaxiosPromise } from './common'; | ||
private validateStatus; | ||
/** | ||
* Encode a set of key/value pars into a querystring format (?foo=bar&baz=boo) | ||
* @param params key value pars to encode | ||
*/ | ||
private paramsSerializer; | ||
private translateResponse; | ||
} |
@@ -109,2 +109,3 @@ "use strict"; | ||
opts.validateStatus = opts.validateStatus || this.validateStatus; | ||
opts.paramsSerializer = opts.paramsSerializer || this.paramsSerializer; | ||
opts.responseType = opts.responseType || 'json'; | ||
@@ -117,3 +118,3 @@ if (!opts.headers['Accept'] && opts.responseType === 'json') { | ||
const parts = new url_1.URL(opts.url); | ||
parts.search = qs.stringify(opts.params); | ||
parts.search = opts.paramsSerializer(opts.params); | ||
opts.url = parts.href; | ||
@@ -141,2 +142,9 @@ } | ||
} | ||
/** | ||
* Encode a set of key/value pars into a querystring format (?foo=bar&baz=boo) | ||
* @param params key value pars to encode | ||
*/ | ||
paramsSerializer(params) { | ||
return qs.stringify(params); | ||
} | ||
translateResponse(opts, res, data) { | ||
@@ -143,0 +151,0 @@ // headers need to be converted from a map to an obj |
{ | ||
"name": "gaxios", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "A simple common HTTP client specifically for Google APIs and services.", | ||
@@ -5,0 +5,0 @@ "main": "build/src/index.js", |
@@ -65,2 +65,9 @@ # gaxios | ||
// By default, we use the `querystring` package in node core to serialize | ||
// querystring parameters. You can override that and provide your | ||
// own implementation. | ||
paramsSerializer: (params) => { | ||
return qs.stringify(params); | ||
}, | ||
// The timeout for the HTTP request. Defaults to 0. | ||
@@ -67,0 +74,0 @@ timeout: 1000, |
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
44306
487
123