Skip to content

Commit

Permalink
fixes #28
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed Jul 3, 2024
1 parent a4a34b9 commit da42cf0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fasthtml/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ def _xt_resp(req, resp, hdrs, **bodykw):
if not isinstance(resp, (tuple,list)): resp = (resp,)
http_hdrs,resp = partition(resp, risinstance(HttpHeader))
http_hdrs = {o.k:str(o.v) for o in http_hdrs}
titles,bdy = partition(resp, lambda o: getattr(o, 'tag', '')=='title')
titles,bdy = partition(resp, lambda o: getattr(o, 'tag', '') in ('title','meta'))
if resp and 'hx-request' not in req.headers and not any(getattr(o, 'tag', '')=='html' for o in resp):
if not titles: titles = [Title('FastHTML page')]
resp = Html(Head(titles[0], *flat_xt(hdrs)), Body(bdy, **bodykw))
resp = Html(Head(*titles, *flat_xt(hdrs)), Body(bdy, **bodykw))
return HTMLResponse(to_xml(resp), headers=http_hdrs)

def _wrap_resp(req, resp, cls, hdrs, **bodykw):
Expand Down

0 comments on commit da42cf0

Please sign in to comment.