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

Function TestGetConsidersHTTPStatus201CreatedToBeOK

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

Source from the content-addressed store, hash-verified

673}
674
675func TestGetConsidersHTTPStatus201CreatedToBeOK(t *testing.T) {
676 t.Parallel()
677 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
678 w.WriteHeader(http.StatusCreated)
679 fmt.Fprintln(w, "some data")
680 }))
681 defer ts.Close()
682 want := "some data\n"
683 got, err := script.Get(ts.URL).String()
684 if err != nil {
685 t.Fatalf("unexpected error: %v", err)
686 }
687 if !cmp.Equal(want, got) {
688 t.Error(cmp.Diff(want, got))
689 }
690}
691
692func TestGetUsesPipeContentsAsRequestBody(t *testing.T) {
693 t.Parallel()

Callers

nothing calls this directly

Calls 4

GetFunction · 0.92
StringMethod · 0.80
ErrorMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…