Trình tạo yêu cầu HTTP
Xây dựng trực quan yêu cầu HTTP với phương thức, header, body và sinh mã JavaScript Fetch API sẵn sàng sử dụng.
Danh sách Header
Dữ liệu Body yêu cầu (Thô)
Mã JavaScript Fetch()
fetch("https://api.example.com/v1/auth/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer token123",
},
body: JSON.stringify({
"username": "admin",
"password": "supersecurepassword"
}),
})
.then((response) => response.json())
.then((data) => console.log(data));