From fc74673bb21241a0fe6b73ad518d369516494262 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Fri, 12 Feb 2021 17:51:46 -0800 Subject: [PATCH] Limit methods to GET --- redstring/server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/redstring/server.py b/redstring/server.py index 864aa9a..0dd0d4a 100644 --- a/redstring/server.py +++ b/redstring/server.py @@ -23,18 +23,18 @@ CONFIG_ENVVAR = 'REDSTRING_CONFIG' app = Flask(__name__) -@app.route('/') +@app.route('/', methods=['GET']) def root(): return redirect(url_for('index')) -@app.route('/index/') +@app.route('/index/', methods=['GET']) def index(): document = generate_index_document(current_app.config['root']) return render_template('doc.jinja', document=document, index=True) -@app.route('/doc/') +@app.route('/doc/', methods=['GET']) def document(document_id): doc_path = safe_join(current_app.config['root'], f'{document_id}.json') if not os.path.isfile(doc_path): @@ -44,7 +44,7 @@ def document(document_id): return render_template('doc.jinja', document=doc, index=False) -@app.route('/new/') +@app.route('/new/', methods=['GET']) def new(): document_id = 'new' new_doc = generate_default_document(document_id)