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

httpclient.timeout not exported #10357

Closed
juancarlospaco opened this issue Jan 18, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@juancarlospaco
Copy link
Contributor

commented Jan 18, 2019

Description

httpclient is deprecating getContent and postContent,
those allowed very easy access to the timeout parameter,
so you can just set a long timeout for slow servers and a short timeout for fast servers,
without having to create several httpclients to do only 1 request each instead of just 1 and change its timeout, etc,
I can change stuff like headers because they are exported, but I can not change the timeout of an httpclient.
Other procs on httpclient dont have the timeout argument.
This is not a totally new feature, just is kinda private.

Alternatives

Please export httpclient.timeout.
So this is possible httpclient.timeout = 42.
Just a * on timeout should be enough (?)

The header already works like httpclient.headers = newHttpHeader(),
the point is to allow easy access to changing the timeout.

Additional Information

Nim Compiler Version 0.19.2 [Linux: amd64] at /home/juan/.nimble/bin/nim
nim> import httpclient
nim> var a = newHttpClient(timeout=2)
nim> a.timeout = 9
Error: attempting to call undeclared routine: 'timeout='

Fix

https://github.com/nim-lang/Nim/blob/master/lib/pure/httpclient.nim#L795

Change from:

timeout: int ## Only used for blocking HttpClient for now.

To:

timeout*: int ## Only used for blocking HttpClient for now.

🐱

@Araq Araq closed this in #10618 Feb 10, 2019

Araq added a commit that referenced this issue Feb 10, 2019

Araq added a commit that referenced this issue Feb 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.