DOCS
TRAFEXIADOCSMock Rules & Breakpoints

Mock Rules & Breakpoints

Trafexia allows developers and security QA engineers to intercept, modify, and mock HTTP/HTTPS network responses on-the-fly without altering backend API code.


1. Creating Mock Response Rules

  1. Open Trafexia Desktop -> Go to Rules & Mocking tab in the sidebar.
  2. Click Create New Rule.
  3. Configure the Matching Criteria:
    • Method: GET, POST, PUT, DELETE, or ALL.
    • URL / Host Pattern: Wildcard string or Regex (e.g. *api.example.com/v1/user*).
  4. Configure Response Override:
    • Status Code: 200 OK, 400 Bad Request, 401 Unauthorized, 500 Server Error, etc.
    • Custom Headers: Add custom headers (e.g. Content-Type: application/json, X-Mock-Engine: Trafexia).
    • Response Body: Custom JSON or plain text body.
  5. Click Save Rule and toggle Enable.

2. Interactive Breakpoints (Request & Response Interception)

Breakpoints allow you to pause live network traffic right before a request is sent to the server or right before a response is returned to the mobile client:

  • Request Breakpoints: Pause outgoing HTTP requests to edit headers, URL query parameters, or POST payload body before forwarding to the remote server.
  • Response Breakpoints: Pause incoming HTTP responses to edit status code, headers, or JSON payload body before returning to the mobile application.

3. Use Cases for Mocking & Breakpoints

  • Error Testing: Simulate API failures (500 Server Error, 503 Service Unavailable, 429 Too Many Requests) to test mobile app resilience.
  • Edge Case Data: Inject large strings, null fields, or special characters into API responses to verify app stability.
  • UI State Debugging: Force user roles (e.g. "role": "admin", "subscription": "vip") to inspect hidden app UI screens without backend database edits.