Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Commit e3ab824

Browse files
authored
fix: keepAlive sample (#1561)
* fix: keep alive sample The property should be `agent` * chore: copyright header
1 parent ce6013c commit e3ab824

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

samples/keepalive.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, Google, Inc.
1+
// Copyright 2023 Google LLC
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at
@@ -41,17 +41,11 @@ async function main() {
4141
const agent = new https.Agent({keepAlive: true});
4242

4343
// use the agent as an Axios config param to make the request
44-
const res = await client.request({
45-
url,
46-
httpsAgent: agent,
47-
});
44+
const res = await client.request({url, agent});
4845
console.log(res.data);
4946

5047
// Re-use the same agent to make the next request over the same connection
51-
const res2 = await client.request({
52-
url,
53-
httpsAgent: agent,
54-
});
48+
const res2 = await client.request({url, agent});
5549
console.log(res2.data);
5650
}
5751

0 commit comments

Comments
 (0)