HTTP Mock Service

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.

Quick Start

Configure your mock response:

Generated URL:
-

Example Requests

Success Response (200)

{
  "message": "Success",
  "data": {
    "id": 123,
    "name": "Example Item"
  }
}

Error Response (400)

{
  "error": "Bad Request",
  "details": "Invalid input format"
}

Delayed Response (2s)

{
  "message": "Delayed response",
  "timestamp": "2024-03-14T12:00:00Z"
}

Use Cases

// 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

Controlled API Testing

Perfect for testing your application's behavior with predictable API responses:

  • Test all possible API response scenarios
  • Validate error handling with specific status codes
  • Ensure your app handles different data structures correctly

Frontend-First Development

Build your frontend without waiting for backend development:

  • Create mock endpoints that match your API design
  • Iterate quickly on UI/UX without backend dependencies
  • Parallel development of frontend and backend
// 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);
  }
};

Edge Case Testing

Simulate real-world scenarios that are hard to reproduce:

  • Test timeout handling with controlled delays
  • Simulate network errors and API failures
  • Validate loading states and error messages

Frequently Asked Questions

Pricing

HTTP Mock Service is free.

The roadmap is to add more features and make it more useful.

Rate Limits

To ensure service stability:

  • 20 requests every 10 seconds
  • Maximum response size: 1KB
  • Maximum delay: 10 seconds

Requests

If you have any requests, please contact me on X.