belyalov / tinyweb

Simple and lightweight HTTP async server for micropython
MIT License
239 stars 40 forks source link

Save headers error with resource decorator #61

Open aymericdo opened 1 month ago

aymericdo commented 1 month ago

Make sure you are running the latest version of TinyWeb before reporting an issue.

Device and/or platform: Raspberry Pico

Description of problem: When I use "save_headers" params in @app.resource, it cause an error because save_headers params are not following here https://github.com/belyalov/tinyweb/blob/master/tinyweb/server.py#L631

Expected: We should be able to use this param with the resource decorator and why not, having back the list of those headers in the data response.

Additional info:

Capture d’écran 2024-05-14 à 17 57 18
aymericdo commented 1 month ago

We could just remplace the https://github.com/belyalov/tinyweb/blob/master/tinyweb/server.py#L631 with save_headers=kwargs.pop('save_headers', ['Content-Length', 'Content-Type']), ?