Expose sets the content-type based on the file extension and defaults to 
"text/plain" if there is no extension. Do your filenames have extensions?

On Thursday, August 6, 2015 at 10:49:37 AM UTC-4, Alehandro Ramoz Rodrigez 
wrote:
>
> I have a page *http://localhost:8000/myApp/files 
> <http://localhost:8000/myApp/files>* that can contain links to attached 
> files so if to press on link or to request 
> *http://localhost:8000/myApp/files/file_1 
> <http://localhost:8000/myApp/files/file_1>, *
> *http://localhost:8000/myApp/files/file_2 
> <http://localhost:8000/myApp/files/file_2>*... file content will be 
> displayed. 
> Code for 'files' page Controller is:
> def files():
>     response.headers['Content-Type'] = 'application/json'
>     return dict(files=Expose('.../Desktop/Files'))
> If to send get request to page "files" then in respond I will get 
> *Content-type: 
> application/json*, but if to call 'files/file_1', then I will get  
> *Content-type*:* text/plain* which is not what I need.
> I want to know how to set response.headers not for main page 'files' but 
> for all possible subpages (for files, that can be attached/placed in shared 
> folder)?
> Can someone help me with this issue? Thank you in advance.
>
> P.S. File names and so names of subpages can be various, so I can not 
> create separate page for each file...
>
>  
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to