Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 1570977

Browse files
author
Alan Shaw
authored
feat: add X-Client header for debugging (#7)
resolves #6
1 parent eab5538 commit 1570977

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ func (c *client) sendCar(ctx context.Context, r io.Reader) (cid.Cid, error) {
266266
}
267267
req.Header.Add("Content-Type", "application/car")
268268
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.cfg.token))
269+
req.Header.Add("X-Client", "web3.storage/go")
269270
res, err := c.hc.Do(req)
270271
if err != nil {
271272
return cid.Undef, err
@@ -290,6 +291,7 @@ func (c *client) Get(ctx context.Context, cid cid.Cid) (*w3http.Web3Response, er
290291
return nil, err
291292
}
292293
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.cfg.token))
294+
req.Header.Add("X-Client", "web3.storage/go")
293295
res, err := c.hc.Do(req)
294296
return w3http.NewWeb3Response(res, c.bsvc), err
295297
}
@@ -395,6 +397,7 @@ func (c *client) Status(ctx context.Context, cid cid.Cid) (*Status, error) {
395397
return nil, err
396398
}
397399
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.cfg.token))
400+
req.Header.Add("X-Client", "web3.storage/go")
398401
res, err := c.hc.Do(req)
399402
if err != nil {
400403
return nil, err

0 commit comments

Comments
 (0)