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

@@ -1,7 +1,6 @@
import YAML, { JSON_SCHEMA } from "js-yaml"
import { Map as ImmutableMap } from "immutable"
import parseUrl from "url-parse"
import { serializeError } from "serialize-error"
import isString from "lodash/isString"
import debounce from "lodash/debounce"
import set from "lodash/set"
@@ -482,7 +481,7 @@ export const executeRequest = (req) =>
err.message = "**Failed to fetch.** \n**Possible Reasons:** \n - CORS \n - Network Failure \n - URL scheme must be \"http\" or \"https\" for CORS request."
}
specActions.setResponse(req.pathName, req.method, {
error: true, err: serializeError(err)
error: true, err
})
}
)

View File

@@ -123,8 +123,8 @@ export default {
let newState = state.setIn( [ "responses", path, method ], fromJSOrdered(result) )
// ImmutableJS messes up Blob. Needs to reset its value.
if (win.Blob && res.data instanceof win.Blob) {
newState = newState.setIn( [ "responses", path, method, "text" ], res.data)
if (win.Blob && result.data instanceof win.Blob) {
newState = newState.setIn( [ "responses", path, method, "text" ], result.data)
}
return newState
},