diff --git a/src/main/resources/static/css/custom.css b/src/main/resources/static/css/custom.css index 2501bbf..c3d2941 100644 --- a/src/main/resources/static/css/custom.css +++ b/src/main/resources/static/css/custom.css @@ -1920,4 +1920,8 @@ footer div.foot_info span { .bar-zoom svg:nth-child(1) { padding-left: 20px; +} + +.response_headers td{ + padding: 1px !important; } \ No newline at end of file diff --git a/src/main/resources/static/js/APIClient.js b/src/main/resources/static/js/APIClient.js index 6aabd64..35ba671 100644 --- a/src/main/resources/static/js/APIClient.js +++ b/src/main/resources/static/js/APIClient.js @@ -14,9 +14,10 @@ class APIClient { this.abortController = null; } - async sendAPIRequest(model, preProcessCallback) { + + async sendAPIRequest(model, preProcessCallback, consoleOutput) { // try { - const updatedModel = await this.executePreRequestScript(model); + const updatedModel = await this.executePreRequestScript(model, consoleOutput); let processedRequest = this.replacePlaceholdersWithVariables(updatedModel); if (preProcessCallback) { preProcessCallback(processedRequest); @@ -25,7 +26,6 @@ class APIClient { .then(async response => { const responseData = await response.json(); // Parse the JSON response if (!response.ok) { - // If response is not OK, use the parsed error information const errorMessage = responseData.error || 'Unknown error'; throw new Error(`API 호출 중 오류가 발생했습니다. 사유[${errorMessage}]`); } @@ -40,7 +40,7 @@ class APIClient { _.forEach(data.headers, (header) => { response.headers[header.key] = header.value; }); - return this.executePostRequestScript(model.postRequestScript, response) + return this.executePostRequestScript(model.postRequestScript, response, consoleOutput) .catch(error => { $('.toast-body').text(error); $('.toast').toast('show'); @@ -112,17 +112,13 @@ class APIClient { return request; } - executePreRequestScript(model) { + + executePreRequestScript(model, consoleOutput) { return new Promise((resolve, reject) => { let script = model.preRequestScript; let resultFrame = document.getElementById('preRequest'); this.variables = {}; - model.variables.forEach((item) => { - if (item.enabled) { - this.variables[item.key] = item.value; - } - }); window.preRequestComplete = (updatedModel, error) => { if (error) { @@ -134,7 +130,15 @@ class APIClient { window.temp_variable = this.variables; window.currentRequest = model; + window.consoleOutput = consoleOutput; resultFrame.srcdoc = `