MCPcopy Create free account
hub / github.com/dave/blast / TestErrorCreatingRequest

Function TestErrorCreatingRequest

httpworker/httpworker_test.go:144–161  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestErrorCreatingRequest(t *testing.T) {
145 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))
146 defer ts.Close()
147
148 payload := map[string]interface{}{
149 "method": " ",
150 }
151 response, err := New().Send(context.Background(), payload)
152 expected := map[string]interface{}{
153 "status": "Error creating request",
154 }
155 if err == nil || !strings.Contains(err.Error(), "invalid method") {
156 log.Fatalf("Unexpected error: %v", err)
157 }
158 if !reflect.DeepEqual(response, expected) {
159 t.Fatalf("Unexpected: %#v", response)
160 }
161}
162
163func TestUrlError(t *testing.T) {
164 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))

Callers

nothing calls this directly

Calls 3

NewFunction · 0.70
SendMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected