Skip to content

Bug: NameError: name 'Response' is not defined when starting server #1

@roebi

Description

@roebi

Bug: NameError: name 'Response' is not defined when starting server

Describe the bug

Running apiup crashes after printing the route list with a NameError when Litestar tries to inspect the handler signature.

Steps to reproduce

pip install apiup
apiup

Error

NameError: name 'Response' is not defined

Full traceback originates in litestar/utils/signature.pyget_type_hints()annotationlib.py.

Root cause

from __future__ import annotations makes Python lazy-evaluate all annotations as strings. When Litestar calls get_type_hints() at handler registration time, it resolves -> Response against the global scope — but Response was only imported inside the build_mock_app function body, making it invisible at that point.

Fix

  • Move from litestar.response import Response as LitestarResponse to module level
  • Change handler return type from -> Response to -> Any to avoid Litestar signature introspection

Environment

  • Python 3.14.3
  • apiup 0.1.0
  • litestar latest
  • Fedora (Silverblue)

Labels

bug good first issue

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions