asgi-cors icon indicating copy to clipboard operation
asgi-cors copied to clipboard

Fix max age header for Daphne

Open moritz89 opened this issue 9 months ago • 0 comments

Max age header throws an error when used with Daphne as the age is returned as a string (str) type and not a bytes type.

The fix would be to add encode():

# asgi_cors.py
                        if max_age:
                            new_headers.append(
                                [b"access-control-max-age", str(max_age).encode()]
                            )

moritz89 avatar Feb 03 '25 10:02 moritz89