...

Source file src/edge-infra.dev/pkg/edge/api/client/transport.go

Documentation: edge-infra.dev/pkg/edge/api/client

     1  package client
     2  
     3  import (
     4  	"net/http"
     5  )
     6  
     7  // Transport is a custom http transport for the Edge Client.
     8  type Transport struct {
     9  	// T is the http roundtripper
    10  	T http.RoundTripper
    11  	// Headers are http headers key value pairs that are appended to requests.
    12  	Headers map[string]string
    13  }
    14  
    15  // RoundTrip satisfies the roundtripper interface.
    16  func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
    17  	for key, val := range t.Headers {
    18  		req.Header.Add(key, val)
    19  	}
    20  	return t.T.RoundTrip(req)
    21  }
    22  

View as plain text