diff --git a/httpbin/handlers_test.go b/httpbin/handlers_test.go index 3e2606193754bc6a20548e54223d62b985ec70e0..e554695e8b10de4fe785738cf387b8b9f49a281f 100644 --- a/httpbin/handlers_test.go +++ b/httpbin/handlers_test.go @@ -54,7 +54,7 @@ func assertContentType(t *testing.T, w *httptest.ResponseRecorder, contentType s func assertBodyContains(t *testing.T, w *httptest.ResponseRecorder, needle string) { if !strings.Contains(w.Body.String(), needle) { - t.Fatalf("expected string %v in body", needle) + t.Fatalf("expected string %q in body %q", needle, w.Body.String()) } } @@ -2254,6 +2254,22 @@ func TestBase64(t *testing.T) { "/base64/decode/" + randStringBytes(Base64MaxLen+1), "Cannot handle input", }, + { + "/base64/", + "No input data", + }, + { + "/base64/decode/", + "No input data", + }, + { + "/base64/decode/dmFsaWRfYmFzZTY0X2VuY29kZWRfc3RyaW5n/extra", + "Invalid URL", + }, + { + "/base64/unknown/dmFsaWRfYmFzZTY0X2VuY29kZWRfc3RyaW5n", + "Invalid operation: unknown", + }, } for _, test := range errorTests {