feat: new ui for response interface generation (#4105)
* feat: codegen body added * feat: new ui added for response interface * feat: generate code component added * chore: default collection tab * feat: generate data schema * chore: clean up * chore: minor code refactor * fix: only render if `isDrawerOpen` is true * chore: clean up * chore: clean up --------- Co-authored-by: nivedin <nivedinp@gmail.com>
This commit is contained in:
@@ -172,13 +172,17 @@ export function useResponseBody(response: HoppRESTResponse): {
|
||||
response.type === "extension_error"
|
||||
)
|
||||
return ""
|
||||
if (typeof response.body === "string") return response.body
|
||||
|
||||
const res = new TextDecoder("utf-8").decode(response.body)
|
||||
// HACK: Temporary trailing null character issue from the extension fix
|
||||
return res.replace(/\0+$/, "")
|
||||
return getResponseBodyText(response.body)
|
||||
})
|
||||
return {
|
||||
responseBodyText,
|
||||
}
|
||||
}
|
||||
|
||||
export function getResponseBodyText(body: ArrayBuffer): string {
|
||||
if (typeof body === "string") return body
|
||||
|
||||
const res = new TextDecoder("utf-8").decode(body)
|
||||
// HACK: Temporary trailing null character issue from the extension fix
|
||||
return res.replace(/\0+$/, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user