Skip to content

Commit 3279e98

Browse files
committed
Merge branch 'non-json-response-files'
2 parents 8085086 + 9299066 commit 3279e98

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Extracting/Strategies/Responses/UseResponseFileTag.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,13 @@ protected function getFileResponses(array $tags)
6262
}
6363
$status = $result[1] ?: 200;
6464
$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));
65+
66+
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+
}
6772

6873
return ['content' => json_encode($merged), 'status' => (int) $status];
6974
}, $responseFileTags);

0 commit comments

Comments
 (0)