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 1.3.0 to 1.4.0

5

build/src/common.d.ts

@@ -23,2 +23,7 @@ import { Agent } from 'https';

export interface GaxiosOptions {
/**
* Optional method to override making the actual HTTP request. Useful
* for writing tests.
*/
adapter?: <T = any>(options: GaxiosOptions) => GaxiosPromise<T>;
url?: string;

@@ -25,0 +30,0 @@ baseUrl?: string;

18

build/src/gaxios.js

@@ -60,9 +60,15 @@ "use strict";

try {
const res = yield node_fetch_1.default(opts.url, opts);
const data = yield this.getResponseData(opts, res);
const translatedResponse = this.translateResponse(opts, res, data);
if (!opts.validateStatus(res.status)) {
throw new common_1.GaxiosError(`Request failed with status code ${res.status}`, opts, translatedResponse);
let translatedResponse;
if (opts.adapter) {
translatedResponse = yield opts.adapter(opts);
}
return this.translateResponse(opts, res, data);
else {
const res = yield node_fetch_1.default(opts.url, opts);
const data = yield this.getResponseData(opts, res);
translatedResponse = this.translateResponse(opts, res, data);
}
if (!opts.validateStatus(translatedResponse.status)) {
throw new common_1.GaxiosError(`Request failed with status code ${translatedResponse.status}`, opts, translatedResponse);
}
return translatedResponse;
}

@@ -69,0 +75,0 @@ catch (e) {

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

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

@@ -79,2 +79,10 @@ # gaxios

// Optional method to override making the actual HTTP request. Useful
// for writing tests.
adapter?: (options) => {
return {
data: 'your data'
}
};
// The expected return type of the request. Options are:

@@ -81,0 +89,0 @@ // json | stream | blob | arraybuffer | text

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