Skip to content

Reject HTTP error responses in LoadURL - #27

Merged
zhengchun merged 1 commit into
antchfx:masterfrom
bensynapse:fix-http-status-errors
Oct 10, 2026
Merged

zhengchun merged 1 commit into
antchfx:masterfrom
bensynapse:fix-http-status-errors

Conversation

@bensynapse

Copy link
Copy Markdown
Contributor

I run Live Tennis API.

LoadURL now returns an error for final HTTP responses outside 200 to 299. A 404 response with valid JSON currently returns a document and no error. Successful responses and redirects keep their existing parsing behavior. Response bodies are closed on every return.

The tests cover successful statuses, redirects, JSON error bodies and body closure. The original implementation fails 14 new subtests.

The native go test . -v -cover command passes on Go 1.23.4 and 1.24.0. go test -race ./... -count=1, go build ./... and go vet ./... pass.

@zhengchun
zhengchun merged commit f21fd28 into antchfx:master Oct 10, 2026
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