Skip to content

Commit

Permalink
Fix linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
tecarter94 committed Dec 9, 2024
1 parent 37122f1 commit 10a77a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pkg/domainproxy/integration/domainproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ func mockHandler(t *testing.T) http.HandlerFunc {
}
w.Header().Set("Content-Type", ContentType)
w.WriteHeader(http.StatusOK)
w.Write(pom)
if _, err := w.Write(pom); err != nil {
t.Fatal(err)
}
} else if r.Method == http.MethodHead && r.URL.Path == MockUrlPath {
// Mock HEAD response
w.Header().Set("Content-Type", ContentType)
Expand Down Expand Up @@ -120,7 +122,7 @@ func startInternalProxyServer(t *testing.T, onRequestFunction func(req *http.Req
}
go func() {
if err := internalProxyServer.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
t.Fatal(err)
t.Error(err)
}
}()
return internalProxyServer
Expand Down
4 changes: 3 additions & 1 deletion pkg/domainproxy/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ func (dps *DomainProxyServer) handleHttpsConnection(sourceConnection net.Conn, w
return
} else if proxyResponse.StatusCode != http.StatusOK {
proxyResponse.Header.Set("Connection", "close")
proxyResponse.Write(sourceConnection)
if err := proxyResponse.Write(sourceConnection); err != nil {
dps.handleErrorResponse(writer, err, "Failed to send internal proxy response to source", true)
}
if err = targetConnection.Close(); err != nil {
common.HandleConnectionCloseError(err)
}
Expand Down

0 comments on commit 10a77a4

Please sign in to comment.