From d5514ab90fd5ec507275a2b6438489ea8589a354 Mon Sep 17 00:00:00 2001 From: Alban Mouton Date: Wed, 23 Sep 2020 17:42:57 +0200 Subject: [PATCH] fix: prevent undefined reference error --- src/OpenApi.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OpenApi.vue b/src/OpenApi.vue index df9b83b..dfed5b4 100644 --- a/src/OpenApi.vue +++ b/src/OpenApi.vue @@ -262,10 +262,12 @@ export default { }) this.currentRequest.security = newSecurity - if (entry.requestBody) { + if (entry.requestBody && entry.requestBody.selectedType) { this.currentRequest.contentType = entry.requestBody.selectedType const example = entry.requestBody.content[this.currentRequest.contentType].example this.currentRequest.body = typeof example === 'string' ? example : stringify(example, null, 2) + } else { + this.currentRequest.body = '' } }, select(entry) {