{"action":"created","issue":{"url":"https://api.github.com/repos/bottlepy/bottle/issues/580","labels_url":"https://api.github.com/repos/bottlepy/bottle/issues/580/labels{/name}","comments_url":"https://api.github.com/repos/bottlepy/bottle/issues/580/comments","events_url":"https://api.github.com/repos/bottlepy/bottle/issues/580/events","html_url":"https://github.com/bottlepy/bottle/issues/580","id":26934326,"number":580,"title":"static_file() throws away response headers","user":{"login":"bbradshaw","id":2446233,"avatar_url":"https://avatars.githubusercontent.com/u/2446233?v=3","gravatar_id":"","url":"https://api.github.com/users/bbradshaw","html_url":"https://github.com/bbradshaw","followers_url":"https://api.github.com/users/bbradshaw/followers","following_url":"https://api.github.com/users/bbradshaw/following{/other_user}","gists_url":"https://api.github.com/users/bbradshaw/gists{/gist_id}","starred_url":"https://api.github.com/users/bbradshaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbradshaw/subscriptions","organizations_url":"https://api.github.com/users/bbradshaw/orgs","repos_url":"https://api.github.com/users/bbradshaw/repos","events_url":"https://api.github.com/users/bbradshaw/events{/privacy}","received_events_url":"https://api.github.com/users/bbradshaw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-02-05T02:47:20Z","updated_at":"2015-07-08T17:57:51Z","closed_at":null,"body":"Trying to figure out why this toy code wasn't working:\r\n```\r\n@app.route('/')\r\ndef get_basic_file():\r\n        response.set_cookie('basic_cookie', 1)\r\n\treturn static_file('index.html', 'path')\r\n```\r\nIt seems the static_file() method never looks at the original response object."},"comment":{"url":"https://api.github.com/repos/bottlepy/bottle/issues/comments/119678355","html_url":"https://github.com/bottlepy/bottle/issues/580#issuecomment-119678355","issue_url":"https://api.github.com/repos/bottlepy/bottle/issues/580","id":119678355,"user":{"login":"camconn","id":5016071,"avatar_url":"https://avatars.githubusercontent.com/u/5016071?v=3","gravatar_id":"","url":"https://api.github.com/users/camconn","html_url":"https://github.com/camconn","followers_url":"https://api.github.com/users/camconn/followers","following_url":"https://api.github.com/users/camconn/following{/other_user}","gists_url":"https://api.github.com/users/camconn/gists{/gist_id}","starred_url":"https://api.github.com/users/camconn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camconn/subscriptions","organizations_url":"https://api.github.com/users/camconn/orgs","repos_url":"https://api.github.com/users/camconn/repos","events_url":"https://api.github.com/users/camconn/events{/privacy}","received_events_url":"https://api.github.com/users/camconn/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T17:57:51Z","updated_at":"2015-07-08T17:57:51Z","body":"I looked around in the bottle docs, and the `BaseResponse.set_cookie` behavior is well defined.\r\n\r\nHowever, `static_file` is only documented in bottle.py right now, and has no reference in the docs even though it's used several times.\r\n\r\n```python\r\n# Starting at line 2460\r\ndef static_file(filename, root,\r\n                mimetype='auto',\r\n                download=False,\r\n                charset='UTF-8'):\r\n    \"\"\" Open a file in a safe way and return :exc:`HTTPResponse` with status\r\n        code 200, 305, 403 or 404. The ``Content-Type``, ``Content-Encoding``,\r\n        ``Content-Length`` and ``Last-Modified`` headers are set if possible.\r\n        Special support for ``If-Modified-Since``, ``Range`` and ``HEAD``\r\n        requests.\r\n        :param filename: Name or path of the file to send.\r\n        :param root: Root path for file lookups. Should be an absolute directory\r\n            path.\r\n        :param mimetype: Defines the content-type header (default: guess from\r\n            file extension)\r\n        :param download: If True, ask the browser to open a `Save as...` dialog\r\n            instead of opening the file with the associated program. You can\r\n            specify a custom filename as a string. If not specified, the\r\n            original filename is used (default: False).\r\n        :param charset: The charset to use for files with a ``text/*``\r\n            mime-type. (default: UTF-8)\r\n    \"\"\"\r\n\r\n    ...\r\n```\r\n\r\nThis definitely needs to be added to the docs though."}}