Re: [flask] Request Mime Type per URL / Method.
- Goran Peretin
- 2011-12-02 @ 11:23
MIME Type is global to you because you set it globally in API view function
(with call to Response.default_mimetype).
You can do what you need by using make_response().
Import make_response from flask in you view file. Then do this in view
function for API call:
resp = make_response('\n'.join(tags))
resp.mimetype = "text/plain"
On 2 December 2011 08:19, Abhishek K <firstname.lastname@example.org> wrote:
> I have a FLask App. with the example routes
> For UI Requests the Mime Type is not set.
> But for each API Request MimeType is set to "text/plain"
> But if the UI is loaded after calling an API, the further UI calls return
> MIME Type as TEXT and is not rendered by Browser.
> Is there a way I cannot not make the Request Global and have it set only
> per request.
> Abhishek Kona
> Software Engineer - Platform.