|
<!DOCTYPE html>
|
|
<html lang="ru">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Тест Ping Service</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
background-color: #f5f5f5;
|
|
}
|
|
.container {
|
|
background: white;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
}
|
|
h1 {
|
|
color: #333;
|
|
text-align: center;
|
|
}
|
|
.test-section {
|
|
margin: 20px 0;
|
|
padding: 15px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 5px;
|
|
}
|
|
button {
|
|
background-color: #007bff;
|
|
color: white;
|
|
border: none;
|
|
padding: 10px 20px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
margin: 5px;
|
|
}
|
|
button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
.result {
|
|
margin-top: 10px;
|
|
padding: 10px;
|
|
background-color: #f8f9fa;
|
|
border-radius: 4px;
|
|
white-space: pre-wrap;
|
|
}
|
|
.success {
|
|
border-left: 4px solid #28a745;
|
|
}
|
|
.error {
|
|
border-left: 4px solid #dc3545;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>Тест HTTP-сервиса Ping Service</h1>
|
|
|
|
<div class="test-section">
|
|
<h3>Тест 1: GET /ping</h3>
|
|
<p>Проверяет доступность сервиса и получение HTML ответа с текстом "pong"</p>
|
|
<button onclick="testPing()">Выполнить тест</button>
|
|
<div id="pingResult" class="result" style="display: none;"></div>
|
|
</div>
|
|
|
|
<div class="test-section">
|
|
<h3>Инструкции по использованию</h3>
|
|
<p><strong>URL сервиса:</strong> <code>http://1c.kb99.pro/gar_info/hs/monitoring/ping</code></p>
|
|
<p><strong>Метод:</strong> GET</p>
|
|
<p><strong>Ответ:</strong> HTML страница с текстом "pong"</p>
|
|
<p><strong>Назначение:</strong> Мониторинг доступности публикации 1С</p>
|
|
</div>
|
|
|
|
<div class="test-section">
|
|
<h3>Примеры использования</h3>
|
|
<h4>cURL:</h4>
|
|
<code>curl http://1c.kb99.pro/gar_info/hs/monitoring/ping</code>
|
|
|
|
<h4>PowerShell:</h4>
|
|
<code>Invoke-WebRequest -Uri "http://1c.kb99.pro/gar_info/hs/monitoring/ping"</code>
|
|
|
|
<h4>JavaScript (fetch):</h4>
|
|
<code>fetch('http://1c.kb99.pro/gar_info/hs/monitoring/ping')</code>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
async function testPing() {
|
|
const resultDiv = document.getElementById('pingResult');
|
|
resultDiv.style.display = 'block';
|
|
resultDiv.textContent = 'Выполняется тест...';
|
|
resultDiv.className = 'result';
|
|
|
|
try {
|
|
// Замените URL на ваш реальный адрес сервера
|
|
const url = 'http://1c.kb99.pro/gar_info/hs/monitoring/ping';
|
|
|
|
const response = await fetch(url, {
|
|
method: 'GET',
|
|
headers: {
|
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
|
|
}
|
|
});
|
|
|
|
if (response.ok) {
|
|
const html = await response.text();
|
|
resultDiv.textContent = `✅ Успешно!\n\nСтатус: ${response.status}\nВремя ответа: ${new Date().toLocaleString()}\n\nHTML ответ:\n${html}`;
|
|
resultDiv.className = 'result success';
|
|
} else {
|
|
resultDiv.textContent = `❌ Ошибка!\n\nСтатус: ${response.status}\nСтатус текст: ${response.statusText}`;
|
|
resultDiv.className = 'result error';
|
|
}
|
|
} catch (error) {
|
|
resultDiv.textContent = `❌ Ошибка подключения!\n\n${error.message}\n\nВозможные причины:\n- Сервер 1С не запущен\n- Неправильный URL\n- Проблемы с сетью\n- CORS блокировка`;
|
|
resultDiv.className = 'result error';
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|