Create instant mock APIs with custom responses, status codes, and delays. Perfect for frontend development and testing edge cases without setting up a backend. Just configure, copy the URL, and you're ready to go.
Configure your mock response:
-
{
"message": "Success",
"data": {
"id": 123,
"name": "Example Item"
}
}
{
"error": "Bad Request",
"details": "Invalid input format"
}
{
"message": "Delayed response",
"timestamp": "2024-03-14T12:00:00Z"
}
// Mock user API response
const API_URL = 'https://usehttpmock.com/api';
const mockResponse = {
user: {
id: 123,
name: 'John Doe',
role: 'admin'
}
};
const endpoint = `${API_URL}?response=
btoa(
JSON.stringify(mockResponse))}`;
// Use endpoint in your tests with a mocked request
Perfect for testing your application's behavior with predictable API responses:
Build your frontend without waiting for backend development:
// Testing error handling
const response = await fetch('https://usehttpmock.com/api?
return_status=200&response=ewogIC[...]gp9')
if(!response.ok) {
return redirect('/login')
} else {
return ({user: response.json()})
}
// Testing loading states
const fetchWithTimeout = async () => {
const url = 'https://usehttpmock.com/api/?delay=2';
showLoadingSpinner();
try {
const response = await fetch(url);
const data = await response.json();
hideLoadingSpinner();
return data;
} catch (error) {
handleError(error);
}
};
Simulate real-world scenarios that are hard to reproduce:
HTTP Mock Service is free.
The roadmap is to add more features and make it more useful.
To ensure service stability:
If you have any requests, please contact me on X.