improvement: gracefully render malformed and empty requestBodies (via #5208)

This commit is contained in:
kyle
2019-02-28 19:54:21 -08:00
committed by GitHub
parent 0990aa82f2
commit e95588bd1f

View File

@@ -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
}