We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8085086 + 9299066 commit 3279e98Copy full SHA for 3279e98
src/Extracting/Strategies/Responses/UseResponseFileTag.php
@@ -62,8 +62,13 @@ protected function getFileResponses(array $tags)
62
}
63
$status = $result[1] ?: 200;
64
$content = $result[2] ? file_get_contents($filePath, true) : '{}';
65
- $json = ! empty($result[3]) ? str_replace("'", '"', $result[3]) : '{}';
66
- $merged = array_merge(json_decode($content, true), json_decode($json, true));
+
+ try {
67
+ $json = ! empty($result[3]) ? str_replace("'", '"', $result[3]) : '{}';
68
+ $merged = array_merge(json_decode($content, true), json_decode($json, true));
69
+ } catch (\Exception $e) {
70
+ $merged = $content;
71
+ }
72
73
return ['content' => json_encode($merged), 'status' => (int) $status];
74
}, $responseFileTags);
0 commit comments