New Fluxzy 2.0 just shipped. Electron is out, Tauri is in. Fresh design, 3x smaller install. Learn more

Mock response body

This is an example of alteration rule among many others. You can explore all rules available at Settings > Manage rules > Add a new rule.

Mocking response body is made through adding a rule with a mock response body action. You can referer to modifying traffic with rules for more information about rules.

  • Open rule management in one of the following ways:

    • Settings menu > manage rules
    • Status bar > active rule
    • Ctrl+T or Cmd+T to access the search everywhere tool, then type Manage rules
  • Click on Add a new rule button

  • Search for mock response and select it

  • At this point you should have the following dialog box:

alt text

  • Fill the form:
    • Status Code : The desired status code for the response (200 for this example)
    • Content type: Choose the content-type from the list (for this example, json). Leave it to unknown if you want Fluxzy to detect the content type from the provided body.
    • Body type: Choose how the request body will be retrieved (for this example, FromString)
      • FromString: The body will be taken from the provided string, for this sample will be {"message": "Hello world"}
      • FromImmediateArray: The body will be taken from the provided base64 string
      • FromFile: The body will be taken from the provided file name
    • Add additional response header you want to send to the client
  • Choose a filter. The specified action will only be applied to requests that match the filter. For this example, we will choose Select filter and Full url filter and fill with https://test-mock.com.

alt text

Save everything, now the rule should appear on rule management dialog

alt text

Now, any request to https://test-mock.com will have a response with status code 200 and a body containing {"message": "Hello world"}.

ESC