From d16924953824e6f131cc8cdeeb8ad20265603212 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 17 Aug 2017 15:45:26 +0100 Subject: [PATCH] Better fix and change status to 400 for upload errors --- lib/Pear/LocalLoop/Controller/Api/Upload.pm | 26 +++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/Upload.pm b/lib/Pear/LocalLoop/Controller/Api/Upload.pm index 45f0d52..253dfc0 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Upload.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Upload.pm @@ -147,11 +147,14 @@ sub post_upload { } unless ( defined $organisation ) { - return $c->render( json => { - success => Mojo::JSON->false, - message => 'Error Finding Organisation', - error => 'organisation_error', - }); + return $c->render( + json => { + success => Mojo::JSON->false, + message => 'Error Finding Organisation', + error => 'organisation_error', + }, + status => 400, + ); } my $transaction_value = $validation->param('transaction_value'); @@ -171,11 +174,14 @@ sub post_upload { ); unless ( defined $new_transaction ) { - return $c->render( json => { - success => Mojo::JSON->false, - message => 'Error Adding Transaction', - error => 'transaction_error', - }); + return $c->render( + json => { + success => Mojo::JSON->false, + message => 'Error Adding Transaction', + error => 'transaction_error', + }, + status => 400, + ); } return $c->render( json => {