You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: go/README.md
+15-4Lines changed: 15 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,10 @@ func main() {
122
122
123
123
If you want even greater control over the lifecycle of the HTTP requests consider providing a [context](https://pkg.go.dev/context). Contexts can be set for all requests or per request.
124
124
125
+
If you wish to include timeout functionality in your custom context then you should leverage [context.WithTimeout](https://pkg.go.dev/context#WithTimeout).
126
+
127
+
> Note: Setting a context will override any "Timeout" settings that you have applied!
128
+
125
129
#### Custom Context for all requests
126
130
127
131
Follow the example code snippet below if you want all requests to use the same context:
> Note: A context set here will also apply to background requests to fetch/refresh oauth tokens, which are normally separated from contexts set via the Timeout property.
150
+
145
151
#### Custom Context per request
146
152
147
-
Follow the example here to set a context for a specific request. **This will override any context set in the SDK config as outlined in the previous section.**
153
+
Follow the example here to set a context for a specific request.
154
+
155
+
> Note: This will override any "Timeout" settings that you have applied, as well as any context set in the SDK config as outlined in the previus section!
> Note: Setting a context per request will NOT affect the context used for the background token fetching requests. If you have also set a context for all requests as mentioned above then that context
174
+
will still be used for the token requests, otherwise the SDK will fall back on using a completely separate context for the token fetching requests.
0 commit comments