MCPcopy Create free account
hub / github.com/brimdata/super / newRequest

Function newRequest

api/client/request.go:35–51  ·  view source on GitHub ↗
(ctx context.Context, host string, h http.Header)

Source from the content-addressed store, hash-verified

33}
34
35func newRequest(ctx context.Context, host string, h http.Header) *Request {
36 if requestID := api.RequestIDFromContext(ctx); requestID != "" {
37 h.Set(api.RequestIDHeader, requestID)
38 }
39 req := &Request{
40 Header: h,
41 host: host,
42 }
43 // use trace to track timing
44 req.ctx = httptrace.WithClientTrace(ctx, &httptrace.ClientTrace{
45 DNSStart: func(httptrace.DNSStartInfo) { req.dnsStartTime = time.Now() },
46 GotConn: func(g httptrace.GotConnInfo) { req.gotConnInfo = g },
47 GetConn: func(string) { req.getConnTime = time.Now() },
48 GotFirstResponseByte: func() { req.firstByteTime = time.Now() },
49 })
50 return req
51}
52
53func (r *Request) HTTPRequest() (*http.Request, error) {
54 body, err := r.getBody()

Callers 1

NewRequestMethod · 0.70

Calls 2

RequestIDFromContextFunction · 0.92
SetMethod · 0.45

Tested by

no test coverage detected