curl -X GET http://localhost:8080/api/service1/test -i
HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
"error": "Отсутствует заголовок авторизации"
}
node -e "console.log(require('jsonwebtoken').sign({ user: 'test' }, 'your_secret_key', { expiresIn: '1h' }))"
curl -X GET http://localhost:8080/api/service1/test \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-i
curl -X POST http://localhost:8080/api/service1/data \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Hello, microservice!"}' \
-i
curl -X GET http://localhost:8080/api/service1/test \
-H "Authorization: Bearer INVALID_TOKEN" \
-i
HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
"error": "Неверный токен"
}
curl -X PUT http://localhost:8080/api/service1/resource/123 \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"updated": true}' \
-i
curl -X GET http://localhost:8080/api/service1/test \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Custom-Header: TestValue" \
-v