Skip to content

Request option timeout not working on node #339

@ottodriver

Description

@ottodriver
import { Impit } from 'impit';

const client = new Impit({
    timeout: 10
});

try {
    const response = await client.fetch('https://www.google.com', {
        method: 'GET',
        timeout: 10
    });
    console.log((await response.text()).slice(0, 1000));
} catch (err) {
    console.log(err.message);
}
% node test.mjs
impit error: Request timeout (10 ms) exceeded.
import { Impit } from 'impit';

const client = new Impit({
    //timeout: 10
});

try {
    const response = await client.fetch('https://www.google.com', {
        method: 'GET',
        timeout: 10
    });
    console.log((await response.text()).slice(0, 1000));
} catch (err) {
    console.log(err.message);
}
% node test.mjs
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="es-419"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script nonce="qArNur3jN4WHl8NrLyd9BQ">(function(){var _g={kEI:'GLdBaYOrCL7U1sQPocfQqQY',kEXPI:'0,18168,184837,45,1101175,2,3,4,2845678,55288,34845,14112,425602,5532595,12,222,36811539,25228681,152392,65157,30633,9138,4600,6553,63455,710,23268,37791,28336,48277,31035,7714,14750,6052,12583,4719,21511,25591,9881,15416,21042,9921,10753,1223,4372,6292,16179,2747,2,4,1,13145,5443,519,682,18855,1195,187,4,1514,3355,197,4066,1747,2,4205,1794,16,8477,1430,4384,2,876,2229,5089,19,3008,26,769,23254,1400,7617,3321,1031,1034,4303,323,522,2047,1,1,6,438,1128,3,2842,9,27,8,2303,9,1,1,3,738,1012,1745,4,3514,3,1119,4780,4,5773,4,696,1475,72,240,297,5,1113,389,4,298,164,2185,5,2708,2111,15,734,298,4309,4944,1275,7,1785,4,999,46,2,2338

Metadata

Metadata

Assignees

Labels

t-toolingIssues with this label are in the ownership of the tooling team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions