Skip to content

Delivering HTML-, JSON and other files #8

@cheetahbyte

Description

@cheetahbyte

I think Ermine needs something that is able to deliver HTML-Files. At the moment the only option is to either take the HTMLResponse which accepts the HTML Content as a string (you need to read the file manually) or to take FileResponse, where you have to set the Content-Type Header manually for the browser to render your html properly.

There should be a solution like:

@app.get("/")
async def home():
    return HTMLFileResponse("/path/to/html/file")

the same applies to other files like JSON and so on.
I think that generic filetype responses should be included, for easier use of ermine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions