HTTP/2 option ignore timeout option
Environment details
- OS:
- Node.js version: 18.15.0
- npm version: 9.5.0
-
googleapisversion: 112.0.0
Steps to reproduce
- set http2 and timeout options to google.options
google.options({http2: true, timeout: 1})
- send any request to google apis
google.calendar().events.list({calendarId: ${calendarId}})
I expect api request fails.because it has very short timeout but i got response successfully unlike request through HTTP/1.1 I guess googleapi-common library does not fully support options. because I tested googleapi-common http2 module, the module ignored timeout config.
test code comparing http2 module to node-fetch module
import { request } from 'googleapis-common/build/src/http2';
import nodefetch from 'node-fetch';
request({
timeout: 1,
url: 'https://www.google.com',
headers: { timeout: 1 },
}).then((r) => {
console.log(r);
});
nodefetch('https://www.google.com', { timeout: 1 }).catch(console.error);
I tracked down the underlying cause and it turns out there is some type confusion between the options that common.http2 accepts and the options ClientHttp2Session which makes the underlying calls accepts. The above mentioned issue will need to be resolved before this issue can be closed. Going to bump the priority of this down in the meantime.
Changing to feature request as things work as intended but there is a lot of mixing of types and arguments that could be handled a lot better.
Thank you for your work.
if this problem is solved it will be great help to improve my user experience.