mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 05:37:53 +08:00
25 lines
539 B
Go
25 lines
539 B
Go
package httpclientprovider
|
|
|
|
import (
|
|
"bytes"
|
|
"io/ioutil"
|
|
"net/http"
|
|
|
|
"github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
|
|
)
|
|
|
|
type testContext struct {
|
|
callChain []string
|
|
}
|
|
|
|
func (c *testContext) createRoundTripper(name string) http.RoundTripper {
|
|
return httpclient.RoundTripperFunc(func(req *http.Request) (*http.Response, error) {
|
|
c.callChain = append(c.callChain, name)
|
|
return &http.Response{
|
|
StatusCode: http.StatusOK,
|
|
Request: req,
|
|
Body: ioutil.NopCloser(bytes.NewBufferString("")),
|
|
}, nil
|
|
})
|
|
}
|