package server import ( "net/http" "net/http/httptest" "testing" ) // TestEncryptedImageRouteAnswersHEAD verifies that HEAD on the encrypted image // route reaches its handler, as GET does, instead of being answered 405 Method // Not Allowed. The handler refuses a token it cannot decrypt with 400, so that // status shows the request got through. func TestEncryptedImageRouteAnswersHEAD(t *testing.T) { t.Parallel() s := newTestServer(t) rec := httptest.NewRecorder() s.ServeHTTP(rec, httptest.NewRequestWithContext( t.Context(), http.MethodHead, encryptedImagePath, nil)) t.Logf("status %d", rec.Code) if rec.Code != http.StatusBadRequest { t.Errorf("status = %d, want %d from the encrypted image handler", rec.Code, http.StatusBadRequest) } }