From 73602958ed94bd39ac7080c96e65f7c5202b2416 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Wed, 26 Mar 2014 13:53:14 +0000 Subject: [PATCH] Fix bug with POST uploads returning 400 client error --- moto/s3/responses.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/moto/s3/responses.py b/moto/s3/responses.py index 27aa0118d..d3ae3876f 100644 --- a/moto/s3/responses.py +++ b/moto/s3/responses.py @@ -100,7 +100,10 @@ class ResponseObject(object): form[k] = v key = form['key'] - f = form['file'] + if 'file' in form: + f = form['file'] + else: + f = request.files['file'].stream.read() new_key = self.backend.set_key(bucket_name, key, f)