question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to set custom timeout for request

See original GitHub issue

Ktor Version

1.2.0

Ktor Engine Used(client or server and name)

CIO client

Feedback

Is it possible to set a custom timeout for request, not client? Something like

client.call("url", timeout = 20) { ... }

For now, I see only feature to set timeout for client:

HttpClient(CIO) {
    engine { requestTimeout = 20 }
}

My use case

I want to use the same client for long polling and common requests.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
enleurcommented, Feb 26, 2020
2reactions
e5lcommented, Nov 18, 2019

Sure! It’ll be possible to do with the HttpTimeout feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting a Request Timeout for a Spring REST API - Baeldung
Spring provides us with a property called spring.mvc.async.request-timeout. This property allows us to define a request timeout with millisecond ...
Read more >
Always use a timeout for http requests | by Abu Ashraf Masnun
By setting a timeout, we're basically saying, if the server doesn't respond within this time, I can no longer keep waiting for it...
Read more >
How to Timeout a fetch() Request - Dmitri Pavlutin
A good approach when making network requests is to configure a request timeout of about 8 - 10 seconds. As shown in the...
Read more >
How to set a timeout on a http.request() in Node?
var req = http.request(options, function(res) { // Usual stuff: on(data), on(end), ...
Read more >
How to set a timeout for a Curl request? - ReqBin
You can set a timeout for connecting to the server with the --connect-timeout command-line option and a timeout for the total request time ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found