Skip to content

Fix debug logs showing empty Host for API requests#1525

Open
hectorcast-db wants to merge 2 commits intomainfrom
fix-debug-logging
Open

Fix debug logs showing empty Host for API requests#1525
hectorcast-db wants to merge 2 commits intomainfrom
fix-debug-logging

Conversation

@hectorcast-db
Copy link
Contributor

@hectorcast-db hectorcast-db commented Mar 9, 2026

Changes

Fixes empty Host in debug logs for all API requests (workspace and account level).

API requests use relative paths (e.g. /api/2.0/...), so http.NewRequestWithContext leaves r.Host empty — only requests built from full URLs (like auth token fetches) had it populated. Go silently falls back to r.URL.Host for the wire Host header, so requests always reached the correct server. But RoundTripStringer reads r.Host directly, making the host appear empty in debug logs.

2026/03/09 07:27:52 [DEBUG] GET /api/2.0/preview/scim/v2/Me
> * Host:  <---- no host?
> * Accept: application/json

Fix: set r.Host = url.Host in the request visitor alongside the existing r.URL.Host assignment.

Tests

Manually verified with go run ./test/ using the UNIFIED profile — Host: now shows correctly in debug logs for all API calls.

NO_CHANGELOG=false

API requests use relative paths, so http.NewRequestWithContext leaves
r.Host empty. Go copies r.URL.Host into the Host header automatically
before sending, so requests reach the correct server — but debug logs
read r.Host directly and showed an empty host.

Set r.Host explicitly in the visitor alongside r.URL.Host.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Hector Castejon Diaz <hector.castejon@databricks.com>
Copy link
Contributor

@tejaskochar-db tejaskochar-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Hector Castejon Diaz <hector.castejon@databricks.com>
@github-actions
Copy link

github-actions bot commented Mar 9, 2026

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-go

Inputs:

  • PR number: 1525
  • Commit SHA: f80d2af0c009cc85c082d8c92f6d0980dbb60833

Checks will be approved automatically on success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants