Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(httpretriever): add client headers #233

Merged
merged 1 commit into from
May 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/retriever/httpretriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ var (

const HttpDefaultInitialWait time.Duration = 0

const DefaultUserAgent = "lassie"

var _ TransportProtocol = &ProtocolHttp{}

type ProtocolHttp struct {
Expand Down Expand Up @@ -180,6 +182,8 @@ func makeRequest(ctx context.Context, request types.RetrievalRequest, candidate
return nil, fmt.Errorf("%w for peer %s: %v", ErrBadPathForRequest, candidate.MinerPeer.ID, err)
}
req.Header.Add("Accept", request.Scope.AcceptHeader())
req.Header.Add("User-Agent", DefaultUserAgent)
req.Header.Add("X-Request-Id", request.RetrievalID.String())

return req, nil
}
Expand Down