googleapis-common
Advanced tools
Comparing version 4.3.0 to 4.4.0
@@ -28,2 +28,3 @@ import { GaxiosOptions, GaxiosResponse } from 'gaxios'; | ||
rootUrl?: string; | ||
http2?: boolean; | ||
userAgentDirectives?: UserAgentDirective[]; | ||
@@ -30,0 +31,0 @@ } |
@@ -23,2 +23,3 @@ "use strict"; | ||
const isbrowser_1 = require("./isbrowser"); | ||
const h2 = require("./http2"); | ||
const resolve = require("url"); | ||
@@ -159,5 +160,5 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const isStream = isReadableStream(multipart[1].body); | ||
headers['Content-Type'] = `multipart/related; boundary=${boundary}`; | ||
headers['content-type'] = `multipart/related; boundary=${boundary}`; | ||
for (const part of multipart) { | ||
const preamble = `--${boundary}\r\nContent-Type: ${part['Content-Type']}\r\n\r\n`; | ||
const preamble = `--${boundary}\r\ncontent-type: ${part['content-type']}\r\n\r\n`; | ||
rStream.push(preamble); | ||
@@ -189,6 +190,6 @@ if (typeof part.body === 'string') { | ||
const finale = `--${boundary}--`; | ||
headers['Content-Type'] = `multipart/related; boundary=${boundary}`; | ||
headers['content-type'] = `multipart/related; boundary=${boundary}`; | ||
let content = ''; | ||
for (const part of multipart) { | ||
const preamble = `--${boundary}\r\nContent-Type: ${part['Content-Type']}\r\n\r\n`; | ||
const preamble = `--${boundary}\r\ncontent-type: ${part['content-type']}\r\n\r\n`; | ||
content += preamble; | ||
@@ -208,5 +209,5 @@ if (typeof part.body === 'string') { | ||
const multipart = [ | ||
{ 'Content-Type': 'application/json', body: JSON.stringify(resource) }, | ||
{ 'content-type': 'application/json', body: JSON.stringify(resource) }, | ||
{ | ||
'Content-Type': media.mimeType || (resource && resource.mimeType) || defaultMime, | ||
'content-type': media.mimeType || (resource && resource.mimeType) || defaultMime, | ||
body: media.body, | ||
@@ -226,3 +227,3 @@ }, | ||
params.uploadType = 'media'; | ||
Object.assign(headers, { 'Content-Type': media.mimeType || defaultMime }); | ||
Object.assign(headers, { 'content-type': media.mimeType || defaultMime }); | ||
options.data = media.body; | ||
@@ -270,3 +271,11 @@ } | ||
if (authClient && typeof authClient === 'object') { | ||
return authClient.request(options); | ||
if (options.http2) { | ||
const authHeaders = await authClient.getRequestHeaders(options.url); | ||
const mooOpts = Object.assign({}, options); | ||
mooOpts.headers = Object.assign(mooOpts.headers, authHeaders); | ||
return h2.request(mooOpts); | ||
} | ||
else { | ||
return authClient.request(options); | ||
} | ||
} | ||
@@ -273,0 +282,0 @@ else { |
@@ -7,2 +7,9 @@ # Changelog | ||
## [4.4.0](https://www.github.com/googleapis/nodejs-googleapis-common/compare/v4.3.0...v4.4.0) (2020-06-18) | ||
### Features | ||
* add experimental http/2 support ([#293](https://www.github.com/googleapis/nodejs-googleapis-common/issues/293)) ([4d33ffa](https://www.github.com/googleapis/nodejs-googleapis-common/commit/4d33ffa237e53f6beb88a4e32d6cc7f31f05a8d6)) | ||
## [4.3.0](https://www.github.com/googleapis/nodejs-googleapis-common/compare/v4.2.1...v4.3.0) (2020-06-03) | ||
@@ -9,0 +16,0 @@ |
{ | ||
"name": "googleapis-common", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"description": "A common tooling library used by the googleapis npm module. You probably don't want to use this directly.", | ||
@@ -13,5 +13,7 @@ "repository": "googleapis/nodejs-googleapis-common", | ||
"scripts": { | ||
"prebenchmark": "npm run compile", | ||
"benchmark": "node build/benchmark/bench.js", | ||
"compile": "tsc -p .", | ||
"test": "c8 mocha build/test", | ||
"system-test": "mocha build/system-test", | ||
"system-test": "c8 mocha build/system-test --timeout 600000", | ||
"presystem-test": "npm run compile", | ||
@@ -51,2 +53,3 @@ "fix": "gts fix", | ||
"@types/nock": "^10.0.3", | ||
"@types/proxyquire": "^1.3.28", | ||
"@types/qs": "^6.5.3", | ||
@@ -61,2 +64,3 @@ "@types/sinon": "^9.0.4", | ||
"gts": "^2.0.0", | ||
"http2spy": "^2.0.0", | ||
"is-docker": "^2.0.0", | ||
@@ -72,3 +76,3 @@ "karma": "^5.0.0", | ||
"linkinator": "^2.0.0", | ||
"mocha": "^7.1.1", | ||
"mocha": "^8.0.0", | ||
"mv": "^2.1.1", | ||
@@ -78,3 +82,4 @@ "ncp": "^2.0.0", | ||
"null-loader": "^4.0.0", | ||
"puppeteer": "^3.0.0", | ||
"puppeteer": "^4.0.0", | ||
"proxyquire": "^2.1.3", | ||
"sinon": "^9.0.2", | ||
@@ -88,4 +93,4 @@ "tmp": "^0.2.0", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=10.10.0" | ||
} | ||
} |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
84154
24
1323
41
3
1