python - Setting HTTP status code in Bottle? -


how set http status code of response in bottle?

from bottle import app, run, route, response  @route('/') def f():     response.status = 300 # tried `response.status_code = 300`     return dict(hello='world')  '''strippathmiddleware defined:    http://bottlepy.org/docs/dev/recipes.html#ignore-trailing-slashes '''  run(host='localhost', app=strippathmiddleware(app())) 

as can see, output doesn't return http status code set:

$ curl localhost:8080 -i http/1.0 200 ok date: sun, 19 may 2013 18:28:12 gmt server: wsgiserver/0.1 python/2.7.4 content-length: 18 content-type: application/json  {"hello": "world"} 

i believe should using response

from bottle import response; response.status = 300


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -