Skip to content

Commit

Permalink
fix compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmood Ali committed Mar 24, 2020
1 parent b5581bf commit 9542cbd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion command/agent/agent_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ func TestHTTP_XSS_Monitor(t *testing.T) {
if tc.JSON {
ct = "application/json"
}
require.Equal(t, []string{ct}, resp.HeaderMap.Values("Content-Type"))
require.Equal(t, ct, resp.HeaderMap.Get("Content-Type"))

// Close response writer and log to make AgentMonitor exit
resp.Close()
Expand Down
22 changes: 11 additions & 11 deletions command/agent/fs_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ func TestHTTP_FS_ReadAt_XSS(t *testing.T) {
require.NoError(t, err)
require.Equal(t, xssLoggerMockDriverStdout, string(buf))

require.Equal(t, []string{"text/plain"}, resp.Header.Values("Content-Type"))
require.Equal(t, []string{"nosniff"}, resp.Header.Values("X-Content-Type-Options"))
require.Equal(t, []string{"1; mode=block"}, resp.Header.Values("X-XSS-Protection"))
require.Equal(t, []string{"default-src 'none'; style-src 'unsafe-inline'; sandbox"},
resp.Header.Values("Content-Security-Policy"))
require.Equal(t, "text/plain", resp.Header.Get("Content-Type"))
require.Equal(t, "nosniff", resp.Header.Get("X-Content-Type-Options"))
require.Equal(t, "1; mode=block", resp.Header.Get("X-XSS-Protection"))
require.Equal(t, "default-src 'none'; style-src 'unsafe-inline'; sandbox",
resp.Header.Get("Content-Security-Policy"))
})
}

Expand Down Expand Up @@ -389,11 +389,11 @@ func TestHTTP_FS_Cat_XSS(t *testing.T) {
require.NoError(t, err)
require.Equal(t, xssLoggerMockDriverStdout, string(buf))

require.Equal(t, []string{"text/plain"}, resp.Header.Values("Content-Type"))
require.Equal(t, []string{"nosniff"}, resp.Header.Values("X-Content-Type-Options"))
require.Equal(t, []string{"1; mode=block"}, resp.Header.Values("X-XSS-Protection"))
require.Equal(t, []string{"default-src 'none'; style-src 'unsafe-inline'; sandbox"},
resp.Header.Values("Content-Security-Policy"))
require.Equal(t, "text/plain", resp.Header.Get("Content-Type"))
require.Equal(t, "nosniff", resp.Header.Get("X-Content-Type-Options"))
require.Equal(t, "1; mode=block", resp.Header.Get("X-XSS-Protection"))
require.Equal(t, "default-src 'none'; style-src 'unsafe-inline'; sandbox",
resp.Header.Get("Content-Security-Policy"))
})
}

Expand Down Expand Up @@ -560,7 +560,7 @@ func TestHTTP_FS_Logs_XSS(t *testing.T) {
require.NoError(t, err)
require.Equal(t, xssLoggerMockDriverStdout, string(buf))

require.Equal(t, []string{"text/plain"}, resp.Header.Values("Content-Type"))
require.Equal(t, "text/plain", resp.Header.Get("Content-Type"))
})
}

Expand Down
2 changes: 2 additions & 0 deletions command/agent/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ type HTTPServer struct {
wsUpgrader *websocket.Upgrader
}

type handlerFn func(resp http.ResponseWriter, req *http.Request) (interface{}, error)

// NewHTTPServer starts new HTTP server over the agent
func NewHTTPServer(agent *Agent, config *Config) (*HTTPServer, error) {
// Start the listener
Expand Down

0 comments on commit 9542cbd

Please sign in to comment.