Socket
Socket
Sign inDemoInstall

gaxios

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gaxios - npm Package Compare versions

Comparing version 3.0.4 to 3.1.0

2

build/src/common.d.ts

@@ -34,3 +34,3 @@ /// <reference types="node" />

*/
adapter?: <T = any>(options: GaxiosOptions) => GaxiosPromise<T>;
adapter?: <T = any>(options: GaxiosOptions, defaultAdapter: (options: GaxiosOptions) => GaxiosPromise<T>) => GaxiosPromise<T>;
url?: string;

@@ -37,0 +37,0 @@ baseUrl?: string;

@@ -18,2 +18,3 @@ import { GaxiosOptions, GaxiosPromise } from './common';

request<T = any>(opts?: GaxiosOptions): GaxiosPromise<T>;
private _defaultAdapter;
/**

@@ -20,0 +21,0 @@ * Internal, retryable version of the `request` method.

@@ -70,2 +70,7 @@ "use strict";

}
async _defaultAdapter(opts) {
const res = await fetch(opts.url, opts);
const data = await this.getResponseData(opts, res);
return this.translateResponse(opts, res, data);
}
/**

@@ -79,8 +84,6 @@ * Internal, retryable version of the `request` method.

if (opts.adapter) {
translatedResponse = await opts.adapter(opts);
translatedResponse = await opts.adapter(opts, this._defaultAdapter.bind(this));
}
else {
const res = await fetch(opts.url, opts);
const data = await this.getResponseData(opts, res);
translatedResponse = this.translateResponse(opts, res, data);
translatedResponse = await this._defaultAdapter(opts);
}

@@ -87,0 +90,0 @@ if (!opts.validateStatus(translatedResponse.status)) {

# Changelog
## [3.1.0](https://www.github.com/googleapis/gaxios/compare/v3.0.4...v3.1.0) (2020-07-30)
### Features
* pass default adapter to adapter option ([#319](https://www.github.com/googleapis/gaxios/issues/319)) ([cf06bd9](https://www.github.com/googleapis/gaxios/commit/cf06bd9f51cbe707ed5973e390d31a091d4537c1))
### [3.0.4](https://www.github.com/googleapis/gaxios/compare/v3.0.3...v3.0.4) (2020-07-09)

@@ -4,0 +11,0 @@

{
"name": "gaxios",
"version": "3.0.4",
"version": "3.1.0",
"description": "A simple common HTTP client specifically for Google APIs and services.",

@@ -28,3 +28,5 @@ "main": "build/src/index.js",

"clean": "gts clean",
"precompile": "gts clean"
"precompile": "gts clean",
"api-extractor": "api-extractor run --local",
"api-documenter": "api-documenter yaml --input-folder=temp"
},

@@ -42,2 +44,4 @@ "repository": "googleapis/gaxios",

"@compodoc/compodoc": "^1.1.9",
"@microsoft/api-documenter": "^7.8.10",
"@microsoft/api-extractor": "^7.8.10",
"@types/cors": "^2.8.6",

@@ -47,3 +51,3 @@ "@types/execa": "^0.9.0",

"@types/extend": "^3.0.1",
"@types/mocha": "^7.0.0",
"@types/mocha": "^8.0.0",
"@types/multiparty": "0.0.32",

@@ -59,2 +63,3 @@ "@types/mv": "^2.1.0",

"c8": "^7.0.0",
"chai": "^4.2.0",
"codecov": "^3.2.0",

@@ -84,3 +89,3 @@ "cors": "^2.8.5",

"tmp": "0.2.1",
"ts-loader": "^7.0.0",
"ts-loader": "^8.0.0",
"typescript": "^3.8.3",

@@ -87,0 +92,0 @@ "uuid": "^8.0.0",

@@ -83,7 +83,10 @@ # gaxios

// Optional method to override making the actual HTTP request. Useful
// for writing tests.
adapter?: (options) => {
return {
data: 'your data'
}
// for writing tests and instrumentation
adapter?: async (options, defaultAdapter) => {
const res = await defaultAdapter(options);
res.data = {
...res.data,
extraProperty: 'your extra property',
};
return res;
};

@@ -90,0 +93,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc