File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 8
8
9
9
namespace WorkerJS \PHPClient ;
10
10
11
+ use WorkerJS \PHPClient \exceptions \InvalidRequestException ;
12
+
11
13
class TaskMessageRequestHandler {
12
14
private $ client ;
13
15
@@ -24,6 +26,10 @@ public function handleRequest(string $body) {
24
26
$ body = json_decode ($ body );
25
27
//TODO: Check protocol
26
28
29
+ if ($ body === null && json_last_error () !== JSON_ERROR_NONE ) {
30
+ throw new InvalidRequestException ("Invalid request " );
31
+ }
32
+
27
33
$ taskID = $ body ->taskID ;
28
34
29
35
$ task = $ this ->client ->getTaskByID ($ taskID );
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: miljanrakita
5
+ * Date: 12/25/18
6
+ * Time: 1:34 AM
7
+ */
8
+
9
+ namespace WorkerJS \PHPClient \exceptions ;
10
+
11
+
12
+ class InvalidRequestException extends \Exception {}
13
+
You can’t perform that action at this time.
0 commit comments