mirror of
https://github.com/grafana/grafana.git
synced 2025-01-02 12:17:01 -06:00
062d255124
* replace ioutil.ReadFile -> os.ReadFile * replace ioutil.ReadAll -> io.ReadAll * replace ioutil.TempFile -> os.CreateTemp * replace ioutil.NopCloser -> io.NopCloser * replace ioutil.WriteFile -> os.WriteFile * replace ioutil.TempDir -> os.MkdirTemp * replace ioutil.Discard -> io.Discard
25 lines
528 B
Go
25 lines
528 B
Go
package httpclientprovider
|
|
|
|
import (
|
|
"bytes"
|
|
"io"
|
|
"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: io.NopCloser(bytes.NewBufferString("")),
|
|
}, nil
|
|
})
|
|
}
|