(t *testing.T)
| 373 | } |
| 374 | |
| 375 | func TestBadMethodRequest(t *testing.T) { |
| 376 | log.SetOutput(&bytes.Buffer{}) |
| 377 | |
| 378 | req := httptest.NewRequest("PUT", |
| 379 | "http://example.org/query", |
| 380 | nil) |
| 381 | w := httptest.NewRecorder() |
| 382 | queryHandler, err := initQueryHandler(testDbPath, "SELECT * FROM ip_dns WHERE dns = ?", 0) |
| 383 | if err != nil { |
| 384 | t.Fatal(err) |
| 385 | } |
| 386 | queryHandler(w, req) |
| 387 | |
| 388 | resp := w.Result() |
| 389 | defer resp.Body.Close() |
| 390 | |
| 391 | if resp.StatusCode != http.StatusMethodNotAllowed { |
| 392 | t.Fatalf(`resp.StatusCode (%d) != http.StatusMethodNotAllowed (%d)`, resp.StatusCode, http.StatusMethodNotAllowed) |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | type errReader int |
| 397 |
nothing calls this directly
no test coverage detected