fix(spec): render response body for non-200 responses (#9555)

Refs #9556
This commit is contained in:
Oliwia Rogala
2024-02-07 16:05:00 +01:00
committed by GitHub
parent 6362bc3a84
commit a88bed5130
4 changed files with 41 additions and 4 deletions

View File

@@ -0,0 +1,26 @@
/**
* @prettier
*/
describe("#9556: SwaggerUI doesn't render response bodies for non-200 responses", () => {
beforeEach(() => {
const staticResponse = {
statusCode: 400,
headers: { "content-type": "plain/text" },
body: "This should render",
}
cy.intercept("GET", "/400-any", staticResponse).as("request")
})
it("should render response body for a response with 400 status code", () => {
cy.visit("?url=/documents/features/try-it-out-non-200-response-body.yaml")
.get("#operations-default-get_400_any")
.click()
.get(".try-out__btn")
.click()
.get(".execute")
.click()
.wait("@request")
.get(".response-col_description .highlight-code .microlight")
.should("have.text", "This should render")
})
})

View File

@@ -0,0 +1,12 @@
openapi: 3.0.0
info:
version: 1.0.0
title: Test API
description: Test API
paths:
/400-any:
get:
description: returns 400
responses:
default:
description: ok