Conversation
e109394 to
7c76257
Compare
7c76257 to
b0792f8
Compare
|
What do you think about this? Browsers are complaining if we send eg. css files without the correct content type. This auto-detect is particularly useful if serving static files like this: @app.route('/webfiles-static/<fn>')
async def images(req, resp, fn):
await resp.send_file('webfiles-static/{}'.format(fn)) |
|
Hey @metachris Sorry for late reply - got some Christmas related mess last weeks.. )) I was considering adding this before - the problem was increased footprint, and, as I remember it would work for esp8266, but leaving only feeew of RAM free.. Since it is not widely used I decided not to implement it. P.S. For the same reason I've omitted adding response status codes like (200 OK, 404 Not Found). |
|
I understand. Didn't know tinyweb code itself already pushes the limit so far :) |
|
the code length memory issue is (thankfully) likely to soon be a thing of the past: micropython/micropython#8191 perhaps we can revisit this then? |
|
It would be nice, if this could be a separate function, that could be used for detection the mime type based on a filename. contentType = web.guessContentType(filename)
res.send_file(filename, content_type = contentType)Something like the above usecase. Also, would be nice to use @keredson luckily it is merged and now a thing of the past AFAIK :) |
Try to auto-detect mime-type based on filename.