-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Use HttpCompletionOption.ResponseHeadersRead when making HTTP requests to start processing the response as soon as headers are received, rather than waiting for the entire response body.
Current Behavior
var response = await _httpClient.PostAsJsonAsync("chat/completions", request, ...);The default HttpCompletionOption.ResponseContentRead waits for the entire response before returning.
Proposed Change
var response = await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken);Expected Benefits
- Faster response start - Begin processing immediately when headers arrive
- Better memory efficiency - Stream response directly instead of buffering
- Foundation for streaming - Required infrastructure for SSE/streaming support
Priority
🟡 P1 - High Impact
Technical Notes
- Need to ensure proper disposal of response stream
- Consider combining with
ReadAsStreamAsync()for optimal memory usage - This change is a prerequisite for implementing streaming responses
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request