context cancellation not stopping a long HTTP request
I pass a context with a 2s timeout to an http.NewRequestWithContext, but the request sometimes takes much longer and the timeout doesn't seem to fire. Using Go 1.22 and the default http.Client. What am I missing? Do I need to set the client Timeout separately? This is on a work project so I cannot paste everything, but that is the gist.
4 replies