Sha256: f92534dc5d5bb25cb85f490d5ef28a2eb9f8c47f65f643e1cbf10abc6526caf3
Contents?: true
Size: 835 Bytes
Versions: 16
Compression:
Stored size: 835 Bytes
Contents
//go:build go1.18 // +build go1.18 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package runtime import ( "net/http" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/internal/uuid" ) type requestIDPolicy struct{} // NewRequestIDPolicy returns a policy that add the x-ms-client-request-id header func NewRequestIDPolicy() policy.Policy { return &requestIDPolicy{} } func (r *requestIDPolicy) Do(req *policy.Request) (*http.Response, error) { if req.Raw().Header.Get(shared.HeaderXMSClientRequestID) == "" { id, err := uuid.New() if err != nil { return nil, err } req.Raw().Header.Set(shared.HeaderXMSClientRequestID, id.String()) } return req.Next() }
Version data entries
16 entries across 16 versions & 1 rubygems