MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / request

Function request

eventarc/pubsub/test/system.test.js:18–31  ·  view source on GitHub ↗
(method, route, base_url)

Source from the content-addressed store, hash-verified

16const got = require('got');
17
18const request = (method, route, base_url) => {
19 const {ID_TOKEN} = process.env;
20 if (!ID_TOKEN) {
21 throw Error('"ID_TOKEN" environment variable is required.');
22 }
23
24 return got(new URL(route, base_url.trim()), {
25 headers: {
26 Authorization: `Bearer ${ID_TOKEN.trim()}`,
27 },
28 method: method || 'get',
29 throwHttpErrors: false,
30 });
31};
32
33describe('End-to-End Tests', () => {
34 const {BASE_URL} = process.env;

Callers 15

system.test.jsFile · 0.70
app.test.jsFile · 0.50
app.test.jsFile · 0.50
httpInvocationFunction · 0.50
httpInvocationFunction · 0.50
httpInvocationFunction · 0.50
index.test.jsFile · 0.50
index.test.jsFile · 0.50
periodic.test.jsFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected