Skip to content

Conversation

@kenfj
Copy link

@kenfj kenfj commented Nov 6, 2025


name: Pull Request
about: Propose changes to the codebase
title: '[PR] Fix StreamingResponse handling in _resp'
labels: 'bug'
assignees: ''


Related Issue
No issue created; this PR directly addresses the bug as per CONTRIBUTING.md guidelines.

Proposed Changes
This PR fixes a bug where endpoints returning StreamingResponse (or subclasses) with type annotation caused a TypeError: 'StreamingResponse' object is not iterable.
The solution is to short-circuit in _resp and immediately return any Response subclass, regardless of annotation, preventing it from being treated as an iterable.

Types of changes
What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist
Go over all the following points, and put an x in all the boxes that apply:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I am aware that this is an nbdev project, and I have edited, cleaned, and synced the source notebooks instead of editing .py or .md files directly.

Additional Information
The fix was made in 00_core.ipynb and exported to core.py using nbdev workflow.
A notebook cell demonstrates the bug and verifies the fix with a StreamingResponse endpoint and test.
All notebook metadata was cleaned before commit.

@gitnotebooks
Copy link

gitnotebooks bot commented Nov 6, 2025

Found 1 changed notebook. Review the changes at https://app.gitnotebooks.com/AnswerDotAI/fasthtml/pull/792

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.

1 participant