diff --git a/sdk/azcore/runtime/examples_test.go b/sdk/azcore/runtime/examples_test.go index 0294baedda39..425e9e3fbbdf 100644 --- a/sdk/azcore/runtime/examples_test.go +++ b/sdk/azcore/runtime/examples_test.go @@ -4,14 +4,22 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package runtime +package runtime_test import ( "context" "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) func ExampleWithCaptureResponse() { var respFromCtx *http.Response - WithCaptureResponse(context.Background(), &respFromCtx) + ctx := context.TODO() + ctx = runtime.WithCaptureResponse(ctx, &respFromCtx) + // make some client method call using the updated context + // resp, err := client.SomeMethod(ctx, ...) + // *respFromCtx contains the raw *http.Response returned during the client method call. + // if the HTTP transport didn't return a response due to an error then *respFromCtx will be nil. + _ = ctx }