Map Local (File)

Map a file as a response of requests

1. What's it?

The Map Local Tool enables you to use the content of local files as a response to your requests, which are matched with your rules. Map Local Tool could significantly boost your speed development and provide the capability to rapidly test on several edge-cased without explicitly updating the data in your server.

It’s also the must-have tool for QAs or Developers if you would like to test the app’s behavior with various responses.

If you would like to map an Entire Local Directory, let check out the Map Local (Directory) page.

pageMap Local (Directory)

You can do Map Local for GraphQL with the Scripting Tool (Snippet Code)

You can combine Map Local with Breakpoint to modify the content on the fly (2.16.0+)

2. Benefits

There are plenty of scenarios in your debugging time when you would try various types of responses to test the layout or content from your devices, apps:

  • Define a Response and use it as a Response for matched Requests

  • Quick Trying new params in responses.

  • Test the app’s behaviors with different parameters in the responses.

  • Test the UI layout with unusual content.

  • Quickly reproduce the bug with specific paramesters in responses.

  • Mock Fake API with a local File: It's useful for developers would try out the testing APIs which are not in production.

3. Main Feature

  1. Map from a predefined Response => Able to change the HTTP Status Code, Headers, and Body Content

  2. Map from a Local File => Only change the Body and keep the Headers from the Response

  3. Automatically generate a Local File from a Response from a Selected Request.

  4. Directly Edit the content from the app

  5. Auto validate the HTTP Message format

4. Map Local with GraphQL Requests

From Proxyman 2.27.0+, Map Local can work with GraphQL Request by a specific QueryName. Please check out the following GraphQL Document.

pageGraphQL

5. Map Local with Scripting Tool ✅

If you would like to do Map Local with complicated rules, you might check out Scripting since it's easier to achieve the same result.

Please check out these Snippet Code to understand how to map a local file with Javascript Code.

6. Addition

Map Local Tools also offer various ways to quickly manipulate the Rule List and support hotkeys as well.

  • ⌘ + ⌥ + L : Quick open Map Local window.

  • ⌘ + N : New entry

  • ⌘ + E : Edit entry

  • ⌘ + D : Duplicate entry

  • ⌘ + ⌫ : Delete entry

  • Support Multiple-selection entry

  • Quick the Local File in Finder or your favorite Editor.

  • All changes are immediately applied and you don’t need to save.

  • For matched response, the “Content-Type” will automatically replace the type of local file. Ex: application/json, image/png, image/jpg, …. So the app will handle the response appropriately.

7. How to use

  1. Right Click on the Request (which already has a Response) -> Tools -> Map Local. Proxyman will create a rule with the current Response Body (The file is stored in your Desktop folder)

  2. From now, we can directly change the Response body.

  3. Make a request and observe the new Response Body.

8. Tutorials

Last updated