liuxiran commented on a change in pull request #1779: URL: https://github.com/apache/apisix-dashboard/pull/1779#discussion_r615278615
########## File path: web/src/pages/Route/components/DebugViews/DebugDrawView.tsx ########## @@ -229,8 +233,23 @@ const DebugDrawView: React.FC<RouteModule.DebugDrawProps> = (props) => { }, bodyFormData) .then((req) => { setLoading(false); - setResponseBody(JSON.stringify(req.data.data, null, 2)); - setResponseHeader(JSON.stringify(req.data.header, null, 2)); + const resp: RouteModule.debugResponse= req.data; + if (typeof (resp.data) !== 'string') { Review comment: actually when it can be parsed as json, the response Content-type will be `application/json`, so you can try to reuse line244 to format response.data, and put `setResponse(resp)` after line252 to simplify the logic. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org