Commit aadda8cc authored by Łukasz Nowak's avatar Łukasz Nowak

Follow the updated specification.

In order to create subresource of /path/ it is required to use POST not PUT.

References:

 * http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5
 * http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6
parent 4fa8a2e5
...@@ -24,11 +24,11 @@ from config import NetworkcacheConfiguration, NetworkcacheParser ...@@ -24,11 +24,11 @@ from config import NetworkcacheConfiguration, NetworkcacheParser
app = Flask(__name__) app = Flask(__name__)
@app.route('/', methods=['PUT']) @app.route('/', methods=['POST'])
def put(): def post():
""" Save the file on the cache server. """ """ Save the file on the cache server. """
if getattr(request, 'data', None) is None: if getattr(request, 'data', None) is None:
abort(400, 'PUT requires data.') abort(400, 'POST requires data.')
cache_base_folder = app.config.get('CACHE_BASE_FOLDER') cache_base_folder = app.config.get('CACHE_BASE_FOLDER')
file_name = hashlib.sha512(request.data).hexdigest() file_name = hashlib.sha512(request.data).hexdigest()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment