lingo: error out if there's no amount parameter passed to basket API (#10160)

This commit is contained in:
Frédéric Péters 2016-03-09 16:01:45 +01:00
parent a2299d423a
commit a2b8fab5b1
1 changed files with 4 additions and 0 deletions

View File

@ -92,6 +92,10 @@ class AddBasketItemApiView(View):
request_body = json.loads(self.request.body)
extra = request_body.get('extra', {})
if not 'amount' in request.GET and not 'amount' in request_body and \
not 'amount' in extra:
raise Exception('missing amount parameter')
item = BasketItem(amount=0)
item.amount = self.get_amount(request.GET.getlist('amount'))