오류오룽룽

This commit is contained in:
chpark 2025-09-25 16:57:35 +09:00
parent 8f9ef92dba
commit bd3848d5ff
2 changed files with 22 additions and 2 deletions

View File

@ -884,7 +884,7 @@ curl -X DELETE http://localhost:5577/api/users/user005 \
<div class="form-group url-group">
<label for="testUrl">엔드포인트:</label>
<div class="url-input">
<span class="base-url">http://localhost:5577</span>
<span class="base-url" id="baseUrl">http://localhost:5577</span>
<input type="text" id="testUrl" class="form-control" placeholder="/api/data" value="/api/data">
</div>
</div>

View File

@ -12,6 +12,9 @@ document.addEventListener('DOMContentLoaded', function() {
function initializeApp() {
hideLoading();
// 동적으로 현재 서버 주소 설정
updateBaseUrl();
// 저장된 토큰 확인
const savedToken = localStorage.getItem('authToken');
if (savedToken) {
@ -25,6 +28,21 @@ function initializeApp() {
setupEventListeners();
}
// 현재 접속한 서버 주소로 Base URL 업데이트
function updateBaseUrl() {
const currentHost = window.location.host; // 현재 호스트:포트
const currentProtocol = window.location.protocol; // http: 또는 https:
const baseUrl = `${currentProtocol}//${currentHost}`;
// API 테스터의 Base URL 업데이트
const baseUrlElement = document.getElementById('baseUrl');
if (baseUrlElement) {
baseUrlElement.textContent = baseUrl;
}
console.log('Base URL 설정:', baseUrl);
}
// 이벤트 리스너 설정
function setupEventListeners() {
// 로그인 폼
@ -1222,7 +1240,9 @@ async function sendApiRequest() {
return;
}
const fullUrl = `http://localhost:5577${url}`;
// 동적으로 현재 서버 주소 사용
const baseUrl = `${window.location.protocol}//${window.location.host}`;
const fullUrl = `${baseUrl}${url}`;
const startTime = Date.now();
try {