Skip to content

Conversation

@VisargD
Copy link
Collaborator

@VisargD VisargD commented Mar 28, 2025

Code Quality bug fix

Title: fix: handle 246 status code for stream responses

🔄 What Changed

  • Added status code 246 to the list of success status codes for streaming responses
  • Updated conditional checks throughout the code to use the new isSuccessStatusCode variable
  • Enhanced the afterRequestHookHandler to return a 246 status code for streaming responses when hooks fail
  • Modified handleJSONToStreamResponse to preserve status code and status text in streaming responses

🔍 Impact of the Change

  • Improves handling of streaming responses when hooks fail without deny enabled
  • Provides better signaling to clients about partial success with hook failures
  • Maintains consistency in status code propagation throughout the response pipeline

📁 Total Files Changed

  • 2 files modified: src/handlers/responseHandlers.ts and src/handlers/streamHandler.ts
  • Total changes: 39 lines (25 additions, 14 deletions)

🧪 Test Added

N/A - No tests were added in this PR

🔒 Security Vulnerabilities

N/A - No security vulnerabilities were introduced or addressed

Related Issues:

@VisargD VisargD merged commit 26aac26 into main Mar 29, 2025
1 check passed
@VisargD VisargD deleted the fix/246-stream-response branch March 29, 2025 08:51
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.

Handle before_request_hooks (deny: false) failure for stream responses

2 participants