ancient-shoe-86801
11/22/2022, 9:10 PMhtmx-flask, I created a helper to easily generate responses with htmx fields. I want the users to be able to pass a dict or a string for the location header, and for that to work I had to do this:
python
def _stringify(val):
return val if isinstance(val, str) else json.dumps(val)
...
resp.headers["HX-Location"] = _stringify(location)
(where location can be a string or a dict)