.
This commit is contained in:
@@ -28,14 +28,13 @@ class ShayeganController extends Controller
|
||||
$result = $this->client->healthCheck();
|
||||
$status = ! empty($result['ok']) ? 200 : 422;
|
||||
|
||||
return response()->json([
|
||||
return response()->json(array_merge([
|
||||
'ok' => ! empty($result['ok']),
|
||||
'message' => $result['message'] ?? null,
|
||||
'http_status' => $result['http_status'] ?? null,
|
||||
'timeout' => ! empty($result['timeout']),
|
||||
// never echo Config passwords
|
||||
'body' => $this->sanitizeBodyForAdmin($result['body'] ?? null),
|
||||
], $status);
|
||||
], $this->client->debugExchange($result)), $status);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,13 +135,14 @@ class ShayeganController extends Controller
|
||||
}
|
||||
|
||||
$result = $this->client->put($endpoint, $put);
|
||||
$exchange = $this->client->debugExchange($result);
|
||||
if (! empty($result['timeout'])) {
|
||||
$row->sync_status = ShayeganSyncService::STATUS_TIMEOUT;
|
||||
$row->sync_log = (string) ($result['message'] ?? 'timeout');
|
||||
$row->res = json_encode(['timeout' => true], JSON_UNESCAPED_UNICODE);
|
||||
$row->save();
|
||||
|
||||
return response()->json(['ok' => false, 'message' => 'timeout', 'row' => $row], 422);
|
||||
return response()->json(array_merge(['ok' => false, 'message' => 'timeout', 'row' => $row], $exchange), 422);
|
||||
}
|
||||
|
||||
if (! empty($result['ok'])) {
|
||||
@@ -153,7 +153,7 @@ class ShayeganController extends Controller
|
||||
$row->res = json_encode($result['body'] ?? [], JSON_UNESCAPED_UNICODE);
|
||||
$row->save();
|
||||
|
||||
return response()->json(['ok' => true, 'row' => $row]);
|
||||
return response()->json(array_merge(['ok' => true, 'row' => $row], $exchange));
|
||||
}
|
||||
|
||||
$row->sync_status = ShayeganSyncService::STATUS_FAILED;
|
||||
@@ -161,7 +161,7 @@ class ShayeganController extends Controller
|
||||
$row->res = json_encode($result['body'] ?? [], JSON_UNESCAPED_UNICODE);
|
||||
$row->save();
|
||||
|
||||
return response()->json(['ok' => false, 'message' => $row->sync_log, 'row' => $row], 422);
|
||||
return response()->json(array_merge(['ok' => false, 'message' => $row->sync_log, 'row' => $row], $exchange), 422);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user