API시나리오 단계별 실행

This commit is contained in:
현성필
2024-01-09 22:07:40 +09:00
parent f2676c2b9f
commit f4a2523b22
36 changed files with 294 additions and 203 deletions
+8 -8
View File
@@ -288,14 +288,14 @@ class APITester {
`;
}
responseHeaderTemplate(header, index) {
responseHeaderTemplate(key, value) {
return `
<tr data-id="${index}">
<tr>
<td>
<input class="form-control" type="text" name="model.responseModel.headers[${index}].key" value="${header.key}" readonly/>
<input class="form-control" type="text" value="${key}" readonly/>
</td>
<td>
<input class="form-control" type="text" name="model.responseModel.headers[${index}].value" value="${header.value}" readonly/>
<input class="form-control" type="text" value="${value}" readonly/>
</td>
</tr>
`;
@@ -663,7 +663,6 @@ class APITester {
}
renderResponse(tabIndex) {
console.log('renderResponse: ' + tabIndex);
let model = this.apiRequests[tabIndex];
let target = $('#api_request_' + model.id);
target.find('.response_headers').empty();
@@ -677,9 +676,10 @@ class APITester {
this.responseEditors[tabIndex].setValue(model.responseModel.body);
}
if (model.responseModel && model.responseModel.headers) {
for (let i = 0; i < model.responseModel.headers.length; i++) {
target.find('.response_headers').append(this.responseHeaderTemplate(model.responseModel.headers[i], i));
}
const headers = model.responseModel.headers;
Object.entries(headers).forEach(([key, value]) => {
target.find('.response_headers').append(this.responseHeaderTemplate(key, value));
});
}
target.find(".response_status").text("status: " + model.responseModel.status);