Wrong content type on Windows when using StaticFiles #1568
-
i'm using fastapi, but this issue originates from starlette. when using import uvicorn
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles # same as starlette.StaticFiles
app = FastAPI()
app.mount("/static", StaticFiles(directory="./"), name="static") # put something like a blank "a.js" in the current directory to test
if __name__ == '__main__':
uvicorn.run(app, port = 8080) import requests
print(requests.get('http://127.0.0.1:8080/static/a.js').headers['content-type']) i tested the above on linux (ubuntu 20.04 lts), and it works just fine. this seems to only occur on windows this also seems to be only for js files, i tested it with html and css and it returned the correct content type. |
Beta Was this translation helpful? Give feedback.
Answered by
Kludex
Apr 3, 2022
Replies: 1 comment
-
This was already mentioned on #829. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Kludex
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was already mentioned on #829.