From e95588bd1fc30e568591db83b8e3e2bb21714284 Mon Sep 17 00:00:00 2001 From: kyle Date: Thu, 28 Feb 2019 19:54:21 -0800 Subject: [PATCH] improvement: gracefully render malformed and empty requestBodies (via #5208) --- src/core/plugins/oas3/components/request-body.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/plugins/oas3/components/request-body.jsx b/src/core/plugins/oas3/components/request-body.jsx index 30a5e247..15d3c45a 100644 --- a/src/core/plugins/oas3/components/request-body.jsx +++ b/src/core/plugins/oas3/components/request-body.jsx @@ -28,12 +28,12 @@ const RequestBody = ({ const requestBodyDescription = (requestBody && requestBody.get("description")) || null const requestBodyContent = (requestBody && requestBody.get("content")) || new OrderedMap() - contentType = contentType || requestBodyContent.keySeq().first() + contentType = contentType || requestBodyContent.keySeq().first() || "" const mediaTypeValue = requestBodyContent.get(contentType, OrderedMap()) const schemaForMediaType = mediaTypeValue.get("schema", OrderedMap()) - if(!mediaTypeValue) { + if(!mediaTypeValue.size) { return null }