Skip to content

Commit 5f7fb47

Browse files
refactor: minor improvements
1 parent d40d641 commit 5f7fb47

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

e2e_tests/boundary_integration_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ func getChildProcessPID(t *testing.T) int {
4949
return pid
5050
}
5151

52+
// This test runs boundary process with such allowed domains:
53+
// - dev.coder.com
54+
// - jsonplaceholder.typicode.com
55+
// It makes sure you can access these domains with curl tool (using both HTTP and HTTPS protocols).
56+
// Then it makes sure you can NOT access example.com domain which is not allowed (using both HTTP and HTTPS protocols).
5257
func TestBoundaryIntegration(t *testing.T) {
5358
// Find project root by looking for go.mod file
5459
projectRoot := findProjectRoot(t)
@@ -187,7 +192,10 @@ func TestBoundaryIntegration(t *testing.T) {
187192
require.NoError(t, err, "Failed to remove /tmp/boundary-test")
188193
}
189194

190-
// TestContentLengthHeader tests that ContentLength header is properly set, otherwise it fails.
195+
// This test runs boundary process with such allowed domains:
196+
// - example.com
197+
// It makes sure you can access this domain with curl tool (using both HTTP and HTTPS protocols).
198+
// It indirectly tests that ContentLength header is properly set, otherwise it fails.
191199
func TestContentLengthHeader(t *testing.T) {
192200
// Find project root by looking for go.mod file
193201
projectRoot := findProjectRoot(t)

proxy/proxy.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ func (p *Server) forwardRequest(conn net.Conn, req *http.Request, https bool) {
292292

293293
p.logger.Debug("🔒 HTTPS Response", "status code", resp.StatusCode, "status", resp.Status)
294294

295+
// Read the body and explicitly set Content-Length header, otherwise client can hung up on the request.
295296
bodyBytes, err := io.ReadAll(resp.Body)
296297
if err != nil {
297298
p.logger.Error("can't read response body", "error", err)

0 commit comments

Comments
 (0)