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:
Bobby DeSimone 2019-01-30 12:22:03 -08:00 committed by GitHub
parent 236e5cd7de
commit ebc1453292
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 66 deletions

View file

@ -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)
}
}