MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / TestGet

Function TestGet

pkg/util/rest/rest_test.go:33–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31)
32
33func TestGet(t *testing.T) {
34 mux := http.NewServeMux()
35 mux.HandleFunc("/config", func(w http.ResponseWriter, r *http.Request) {
36 if _, err := w.Write([]byte("test")); err != nil {
37 t.Fatal(err)
38 }
39 })
40
41 srv := httptest.NewServer(mux)
42 defer srv.Close()
43
44 resp, err := Get(WithURI("config"), WithTransport(fmt.Sprintf("localhost:%s", port(srv.URL))))
45 require.NoError(t, err)
46 require.NotNil(t, resp)
47 assert.Equal(t, "test", string(resp))
48}
49
50func TestGetPipe(t *testing.T) {
51 usr, err := user.Current()

Callers

nothing calls this directly

Calls 7

WithURIFunction · 0.85
WithTransportFunction · 0.85
portFunction · 0.85
EqualMethod · 0.80
GetFunction · 0.70
WriteMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected