fasthx icon indicating copy to clipboard operation
fasthx copied to clipboard

Page routes cannot have a Request dependency

Open dries007 opened this issue 4 months ago • 0 comments

Page routes cannot have a Request dependency injected.

The root cause is fastapi/fastapi#12403.

See also MR #34 for one possible workaround fix.

Just as an FYI: If this workaround is applied, it should also be applied to the hx decorator, because with the current "return request if header is set" solution, the jinja context gets a "None" object for the key "request".

This is last point was discovered after the initial MR was a made, due to me using the request object for some debug info in a template and finding out it's None in some cases. (In particular also error templates.)

dries007 avatar Oct 08 '24 11:10 dries007