Refactor of History module #184
@@ -88,10 +88,13 @@ async function formatJSON(json) {
|
|||||||
|
|
||||||
var result = await fetch(request).then(response => {
|
var result = await fetch(request).then(response => {
|
||||||
return response.text().then(function (text) {
|
return response.text().then(function (text) {
|
||||||
return JSON.parse(text);
|
var json = JSON.parse(text);
|
||||||
|
json.status = response.status;
|
||||||
|
return json;
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
console.log(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,8 +130,14 @@ function showRequestBody(element){
|
|||||||
switch(historyJson[element.id].headers["content-type"]){
|
switch(historyJson[element.id].headers["content-type"]){
|
||||||
case "application/json":{
|
case "application/json":{
|
||||||
formatJSON(historyRequestBody).then(function(result) {
|
formatJSON(historyRequestBody).then(function(result) {
|
||||||
|
|
||||||
|
if (result.status == "200") {
|
||||||
popupContent.innerText = result.data;
|
popupContent.innerText = result.data;
|
||||||
highlightSyntax('code-highlight-content');
|
highlightSyntax('code-highlight-content');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
popupContent.innerText = historyRequestBody;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user