Skip to content

Instantly share code, notes, and snippets.

@jnewman
Created April 7, 2016 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnewman/23c993ef50bcd69f9086fcd4e2594928 to your computer and use it in GitHub Desktop.
Save jnewman/23c993ef50bcd69f9086fcd4e2594928 to your computer and use it in GitHub Desktop.
from flask import Flask, make_response
app = Flask(__name__)
@app.route('/no-space')
def no():
return make_response(('Hello', 200, {'Content-Disposition': 'attachment; filename=hello.txt'}))
@app.route('/space')
def yes():
return make_response(('Hello', 200, {'Content-Disposition': 'attachment; filename = oh-no.txt'}))
if __name__ == "__main__":
app.run()
Flask==0.10.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
Werkzeug==0.11.5
#!/usr/bin/env bash
pip install -r requirements.pip
python main.py & pid=$!
echo $pid
sleep 5
curl -LOJ 'http://localhost:5000/no-space'
stat hello.txt
curl -LOJ 'http://localhost:5000/space'
stat oh-no.txt
kill $pid
rm hello.txt space
@jnewman
Copy link
Author

jnewman commented Apr 7, 2016

To run, do:

bash ./test.sh

Must have python and pip installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment