apicollective / apibuilder-generator

MIT License
54 stars 36 forks source link

Http4s client: custom default timeouts #276

Open fabiocognigni opened 6 years ago

fabiocognigni commented 6 years ago

Http4s HTTP client uses default config and the default setting for requestTimeout is currently Infinite: https://github.com/http4s/http4s/blob/master/blaze-client/src/main/scala/org/http4s/client/blaze/BlazeClientConfig.scala#L65

We should override it in our generated client. A reasonable value could be responseHeaderTimeout + 5 seconds.

More details on the HTTP client timeouts: https://github.com/http4s/http4s/blob/master/blaze-client/src/main/scala/org/http4s/client/blaze/BlazeClientConfig.scala#L12-L19

fiadliel commented 6 years ago

My opinion: all this functionality should be removed, and the user should pass in the HTTP client from outside.

fabiocognigni commented 6 years ago

Don't we want to give the possibility to both pass in a custom HTTP client and also have a default value param with reasonable timeouts (ready-to-go code generated) ?

fiadliel commented 6 years ago

So where do you put this client that doesn't end up causing hidden internal singleton state?