MCPcopy
hub / github.com/bitfield/script / TestGetUsesPipeContentsAsRequestBody

Function TestGetUsesPipeContentsAsRequestBody

script_test.go:692–709  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

690}
691
692func TestGetUsesPipeContentsAsRequestBody(t *testing.T) {
693 t.Parallel()
694 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
695 want := []byte("request data")
696 got, err := io.ReadAll(r.Body)
697 if err != nil {
698 t.Fatal("reading request body", err)
699 }
700 if !cmp.Equal(want, got) {
701 t.Fatalf("%s", cmp.Diff(want, string(got)))
702 }
703 }))
704 defer ts.Close()
705 _, err := script.Echo("request data").Get(ts.URL).String()
706 if err != nil {
707 t.Errorf("unexpected error: %v", err)
708 }
709}
710
711func TestJoinHandlesLongLines(t *testing.T) {
712 t.Parallel()

Callers

nothing calls this directly

Calls 4

EchoFunction · 0.92
StringMethod · 0.80
GetMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…