callContext
Pull the context that has the associated Job for the request out of the context. HttpClientEngine implementations MUST use this as the context for aws.smithy.kotlin.runtime.http.response.HttpCall.callContext Any request scoped resources or cleanup should be tied to the Job instance of this context.
e.g.
class MyEngine : HttpClientEngineBase("my-engine") {
fun roundTrip(request: HttpRequest): HttpCall {
val callContext = callContext()
val resp = ...
callContext[Job]?.invokeOnCompletion { cause ->
releaseResponse(resp)
}
return HttpCall(req, resp, ..., callContext)
}
}
Content copied to clipboard