Skip to content

Conversation

@yhirose
Copy link
Owner

@yhirose yhirose commented Nov 27, 2025

This PR is trying to implement #2269. It requires C++20 compiler or later which supports C++ coroutines.

- Implemented a new HTTP client in send_with_httplib.cpp using the httplib library.
- Added a logger function to log request and response details, including headers.
- Created a main function to send a POST request to the chat API with a sample message.
- Included error handling for the HTTP response.
- Implement tests for StreamHandle struct to verify its existence and validity checks.
- Create StreamingServerTest to validate the open_stream() method and its behavior with valid and invalid paths.
- Add tests for reading data from streams, including edge cases for buffer sizes and end-of-stream conditions.
- Introduce tests for the Generator API to ensure correct functionality with streaming responses.
- Implement integration tests for chunked transfer encoding, validating both small and large responses.
- Add tests for ClientConnection and BodyReader structs to ensure proper initialization and error handling.
- Include SSL support tests for streaming over secure connections.
…eam::Get() and StreamingResult to stream::Result
…entation

- Implemented a MockStream class for simulating stream behavior in tests.
- Added tests for ClientImpl::StreamHandle, including basic validity checks and error handling.
- Created BodyReader tests to validate reading from streams with and without errors.
- Developed OpenStreamTest suite to test various scenarios including basic requests, large responses, and chunked responses.
- Included SSL support tests for secure connections and chunked data handling.
- Enhanced test coverage for gzip, Brotli, and Zstd compression handling.
@yhirose
Copy link
Owner Author

yhirose commented Nov 27, 2025

@ngxson the only thing of this new stream API is that it requires C++20 which supports C++ coroutines.

Here is README.

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