Skip to content

Commit

Permalink
Fixed callback failed logs caused by status code 201
Browse files Browse the repository at this point in the history
Lednerb committed May 12, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 8e16a37 commit 8c9995e
Showing 6 changed files with 137 additions and 81 deletions.
2 changes: 1 addition & 1 deletion app/Jobs/NotifyCallbacksJob.php
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ public function handle()
'json' => (new ScanCallbackResponse($this->scan))
]);

if ($response->getStatusCode() === 200) {
if (in_array($response->getStatusCode(), [200, 201, 202])) {
Log::info('Scan results for Scan ID ' . $this->scan->id . ' successfully sent to: ' . $this->scan->callbackurls[0]);
$hasAtLeastOneSuccessfulCallback = true;
} else {
2 changes: 1 addition & 1 deletion app/Jobs/StartScannerJob.php
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ public function handle()
]]);


if ($response->getStatusCode() === 200) {
if (in_array($response->getStatusCode(), [200, 201, 202])) {
\Log::info('Scan successful started' . $logInfo);
} else {
\Log::critical('Failed to start scan' . $logInfo);
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -7,6 +7,12 @@
"laravel"
],
"license": "MIT",
"repositories": [
{
"type": "git",
"url": "https://github.com/Lednerb/log-fake.git"
}
],
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
@@ -23,7 +29,7 @@
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.5",
"timacdonald/log-fake": "^1.0"
"timacdonald/log-fake": "dev-feature-loggedTimesWithCallback"
},
"config": {
"optimize-autoloader": true,
Loading

0 comments on commit 8c9995e

Please sign in to comment.