Re: [flask] Request Mime Type per URL / Method.
- From:
- Goran Peretin
- Date:
- 2011-12-02 @ 11:23
Hi Abhishek,
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"
return resp
Best,
Goran
On 2 December 2011 08:19, Abhishek K <abhishek.kona@gmail.com> wrote:
> I have a FLask App. with the example routes
> https://gist.github.com/1422153
>
> 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.
> Flipkart.com
>
>