Skip to content

test: add comprehensive tests for HTTP header parsing and transport#236

Merged
appleboy merged 2 commits intomainfrom
test
May 1, 2025
Merged

test: add comprehensive tests for HTTP header parsing and transport#236
appleboy merged 2 commits intomainfrom
test

Conversation

@appleboy
Copy link
Owner

@appleboy appleboy commented May 1, 2025

  • Add tests for parsing header strings into http.Header, covering normal input, invalid format, duplicate keys, and empty/nil input
  • Add tests for DefaultHeaderTransport to verify attaching custom headers, handling empty app info, propagating errors, and supporting multiple header values

appleboy added 2 commits May 1, 2025 17:25
- Add tests for parsing header strings into http.Header, covering normal input, invalid format, duplicate keys, and empty/nil input
- Add tests for DefaultHeaderTransport to verify attaching custom headers, handling empty app info, propagating errors, and supporting multiple header values

Signed-off-by: appleboy <[email protected]>
- Use NewRequestWithContext with a background context in tests instead of NewRequest
- Add error handling and fail tests immediately if RoundTrip returns an error
- Ensure HTTP response bodies are closed after each test to prevent resource leaks

Signed-off-by: appleboy <[email protected]>
@appleboy appleboy merged commit bebb2ee into main May 1, 2025
10 checks passed
@appleboy appleboy deleted the test branch May 1, 2025 09:42
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.

1 participant