Get without id == trace since browsers dont support trace

This commit is contained in:
Bel LaPointe
2020-07-24 23:25:32 -06:00
parent 55d8cf5d43
commit 663579aeae
2 changed files with 18 additions and 2 deletions

View File

@@ -254,6 +254,23 @@ func TestWho(t *testing.T) {
t.Logf("%+v", v)
})
t.Run("get without id == trace real", func(t *testing.T) {
r := httptest.NewRequest(http.MethodGet, "/who?namespace=col", nil)
w := httptest.NewRecorder()
handler.ServeHTTP(w, r)
if w.Code != http.StatusOK {
t.Fatalf("%d: %s", w.Code, w.Body.Bytes())
}
var v []string
if err := json.Unmarshal(w.Body.Bytes(), &v); err != nil {
t.Fatalf("%v: %s", err, w.Body.Bytes())
}
if len(v) < 5 {
t.Fatal(len(v))
}
t.Logf("%+v", v)
})
t.Run("trace real sorted asc/desc name", func(t *testing.T) {
for _, order := range []string{"1", "-1"} {
r := httptest.NewRequest(http.MethodTrace, "/who?namespace=col&sort=name&order="+order, nil)