Skip to content

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Jan 19, 2026

Summary

The TCP-based HTTP client now parses the HTTP status line and returns a clear error for non-2xx responses instead of attempting to deserialize error bodies as successful JSON payloads.

Problem

Client::search and Client::embed_batch ignored the HTTP status line and always tried to deserialize the response body into the success shape. When the server returned 4xx/5xx responses, this produced confusing errors like "Failed to parse server response".

Solution

  • Read and validate the HTTP status line.
  • If the status code is not 2xx, return an error that includes the HTTP status code and, when available, the server-provided error field.
  • Add regression tests covering both search and embed_batch non-2xx responses.

Testing

  • cargo fmt --check
  • CC=clang CXX=clang++ cargo test
  • CC=clang CXX=clang++ cargo clippy --all-targets -- -D warnings

Related Issue

Fixes PlatformNetwork/bounty-challenge#73

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.

[BUG] HTTP Client Assumes 200 OK - Silently Ignores Server Errors

2 participants