Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Timeout fault #36

Open
b5414 opened this issue Apr 26, 2022 · 1 comment
Open

[Bug] Timeout fault #36

b5414 opened this issue Apr 26, 2022 · 1 comment

Comments

@b5414
Copy link

b5414 commented Apr 26, 2022

Hi, there is a simple example with the latest version of the tiny package

try{
	const data = {test: true};

	await tiny.post({
		url: 'some url for post tests',
		data,
		timeout: 15000,
		headers: {Authorization: 'Bearer ' + token},
	}).then(({body})=>({ok: true, data: body})).catch((e)=>({ok: false, err: e.message + 'this not working'}));
}catch(err){
	console.log('this working', err);
}

Unfortunately it returns err: 'timeout is not defined'

and only the external trycatch works, instead of the promised one

@Loksly
Copy link

Loksly commented Nov 10, 2024

tiny-json-http/dist.js:912:24

if (options.timeout) {
        opts.timeout = timeout; /// this is the bug. This should be options.timeout
      }

src code

https://github.com/brianleroux/tiny-json-http/blob/main/_write.js#L44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants