feat: initial commit

This commit is contained in:
2022-10-09 15:23:52 +02:00
commit a1b4d4fc27
39 changed files with 5810 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package ctl
import (
"net/http"
)
type headerTransport struct {
tripper http.RoundTripper
apiKey string
}
func NewTransport(tripper http.RoundTripper, apiKey string) *headerTransport {
return &headerTransport{
tripper: tripper,
apiKey: apiKey,
}
}
func (t *headerTransport) RoundTrip(req *http.Request) (*http.Response, error) {
req.Header.Set("X-Api-Key", t.apiKey)
return t.tripper.RoundTrip(req)
}