Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Commit 2e7b31d

Browse files
committed
Feat: support example body undefined
1 parent e1d0724 commit 2e7b31d

7 files changed

Lines changed: 333 additions & 361 deletions

File tree

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ function parseExamples (bodies, language) {
562562
function safeSampleParse (body, name, language) {
563563
if (language === 'json') {
564564
const errors = []
565-
const parsedBody = jsonc.parse((body === null || body.trim().length === 0) ? '{}' : body, errors)
565+
const parsedBody = jsonc.parse((body == null || body.trim().length === 0) ? '{}' : body, errors)
566566
if (errors.length > 0) {
567567
throw new Error('Error parsing response example "' + name + '"')
568568
}

0 commit comments

Comments
 (0)