mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-30 06:51:30 +02:00
proxy: use internal/httputil for error handling (#36)
- General formatting and comment cleanup. - Inject pomerium version at compiletime via template package.
This commit is contained in:
parent
236e5cd7de
commit
ebc1453292
7 changed files with 42 additions and 66 deletions
|
@ -8,13 +8,13 @@ import (
|
|||
)
|
||||
|
||||
func TestProxy_RobotsTxt(t *testing.T) {
|
||||
auth := Proxy{}
|
||||
proxy := Proxy{}
|
||||
req, err := http.NewRequest("GET", "/robots.txt", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rr := httptest.NewRecorder()
|
||||
handler := http.HandlerFunc(auth.RobotsTxt)
|
||||
handler := http.HandlerFunc(proxy.RobotsTxt)
|
||||
handler.ServeHTTP(rr, req)
|
||||
if status := rr.Code; status != http.StatusOK {
|
||||
t.Errorf("handler returned wrong status code: got %v want %v", status, http.StatusOK)
|
||||
|
@ -22,6 +22,5 @@ func TestProxy_RobotsTxt(t *testing.T) {
|
|||
expected := fmt.Sprintf("User-agent: *\nDisallow: /")
|
||||
if rr.Body.String() != expected {
|
||||
t.Errorf("handler returned wrong body: got %v want %v", rr.Body.String(), expected)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue