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 from 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 QA or Developer if you would like to test the app’s behavior with various responses.

Map Local Dashboard

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

2. Benefits

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

  • Quick Trying new params in responses.

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

  • Test the UI layout with unusual content.

  • Test Localization.

  • Quick reproduce the bug with specific params in responses.

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

Able to map a specific file as a response of matching request

3. Main Feature

  1. Map from an HTTP Message => 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. How it works

  • If the URL of incoming requests are matching with the pre-defined matching Rule, and the Local file is valid => The body response of those matching requests are automatically replaced with the content of the local file.

  • If the requests are not matching any rules, the entire Response’s content remains from the server.

5. Matching Rule

Proxyman supports Regular Expression and Wildcard from 2.3.0 version. Check out here

You can simply define the rule by a combination of Wildcards and Include subdirectories options.

  • Top-Down Matching: Incoming requests will be evaluated by Top-Down priority. The Rule on the top of the list is the first rule to evaluate.

  • Asterisk ( * ): Matches any character zero or more times. For example, “api.proxyman.io/v1/*” matches anything beginning with “api.proxyman.io/v1/”, such as “api.proxyman.io/v1/login”, “api.proxyman.io/v1/data” and “api.proxyman.io/v1/”, …

  • Question mark ( ? ): Matches a single character once. For example, “api.proxyman.io/v?/login” matches api.proxyman.io/v1/login and api.proxyman.io/v2/login

  • Include subdirectories: All subdirectories will automatically match. It’s super convenient if you want to match all paths from the domain. For example: “api.proxyman.io” with ON in “Include subdirectories” matches all URLs, which have “api.proxyman.io” as a domain, such as “api.proxyman.io”, “api.proxyman.io/v1/data”, “api.proxyman.io/login”, “api.proxyman.io/user?name=nghia”, ….

  • HTTP / HTTPS include: By default, “api.proxyman.io” matches all requests, which have a scheme is HTTP or HTTPS. Otherwise, “http://api.proxyman.io” matches the only HTTP, and “https://api.proxyman.io” matches only HTTPS.

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.

8. How to use

There are various ways to access the Map Local Tool. If we open the Map Local Tool from Domains or flows, it will fill the matching rule automatically.

9. Tutorial