Response Customization
Configure status codes, response delays, custom headers, and advanced response behaviors
What is Response Customization?
Response customization allows you to control exactly how your mock API responds to requests. This includes HTTP status codes, response delays, custom headers, and conditional responses based on request parameters.
Return any HTTP status code to simulate success, errors, or edge cases
Add artificial delays to test loading states and timeout handling
Set custom response headers for CORS, caching, and authentication
Customizing HTTP Status Codes
By default, Mock API Builder returns appropriate status codes for each operation (200 for GET, 201 for POST, etc.). You can override these to test error handling in your application.
OK - Success
Standard successful response
Created
Resource successfully created
No Content
Success with no response body (DELETE operations)
Bad Request
Invalid request data or parameters
Unauthorized
Authentication required or failed
Forbidden
Authenticated but not authorized
Not Found
Resource doesn't exist
Internal Server Error
Server-side error occurred
How to Set Custom Status Codes
- 1. Navigate to your project's endpoint editor
- 2. Select the endpoint you want to customize
- 3. Find the "Response Settings" section
- 4. Enter your desired status code (e.g., 404, 500)
- 5. Save changes - the endpoint will now return that status code
Adding Response Delays
Response delays help you test how your application handles slow network conditions, loading states, and timeout scenarios.
- Test Loading States: Ensure your loading spinners and skeletons work correctly
- Timeout Testing: Verify your app handles request timeouts gracefully
- Slow Network Simulation: Test behavior on 3G/4G mobile connections
- Race Condition Testing: Identify timing-related bugs in your code
Setting Response Delays
Delay Range: 0ms to 10,000ms (10 seconds)
Recommended Values:
- • 500ms-1000ms: Normal API response time
- • 2000ms-3000ms: Slow network conditions
- • 5000ms+: Timeout testing
Add a 2-second delay to your user list endpoint to ensure your loading spinner displays:
Custom Response Headers
Custom headers allow you to control caching, CORS policies, content types, and other HTTP behaviors.
Cache-Control
Control how responses are cached by browsers and CDNs
X-RateLimit-*
Simulate rate limiting headers
Content-Type
Specify response format (usually set automatically)
X-Custom-Header
Add any custom header for testing
CORS Headers
Mock API Builder automatically handles CORS for local development, but you can customize these headers if needed:
Best Practices
• Use realistic delay times (100-3000ms) instead of extreme values
• Test both success and error status codes
• Verify your app handles all HTTP status codes gracefully
• Add comments in your endpoint descriptions explaining custom settings
• Document which endpoints have delays or custom status codes
• Share this information with your team
• Response customization is for testing and development
• Remove artificial delays before moving to production APIs
• Use real production status codes in your final implementation