12167: Propagate X-Request-Id in API calls.
[arvados.git] / services / keepproxy / proxy_client.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package main
6
7 import (
8         "net/http"
9
10         "git.curoverse.com/arvados.git/sdk/go/keepclient"
11 )
12
13 var viaAlias = "keepproxy"
14
15 type proxyClient struct {
16         client    keepclient.HTTPClient
17         proto     string
18         requestID string
19 }
20
21 func (pc *proxyClient) Do(req *http.Request) (*http.Response, error) {
22         req.Header.Add("Via", pc.proto+" "+viaAlias)
23         req.Header.Set("X-Request-Id", pc.requestID)
24         return pc.client.Do(req)
25 }