Skip to content

Map to file

Map to file sends the app a file from your disk as the body of a response.

  • For one URL: right-click a request › Map to file… and pick a file. The rule matches that URL with any query string.
  • For a host or folder: right-click it in Structure › Map to file…
  • From scratch: Breakpoints panel › + › Map to file…, then fill in the URL.

The rule’s URL and Method work as they do for breakpoints. Choose… picks another file and Reveal opens its folder. Its switch turns the rule off.

The request still goes to the server. Its response keeps the server’s status and headers, and the body is replaced with the file.

  • The file is read for every response, so an edit shows up on the next request.
  • Content-Encoding is removed and Cache-Control: no-store is set, so the app asks again rather than keeping a copy.
  • If the server sent no Content-Type, one is picked from the file’s extension.
  • A 304 Not Modified becomes 200 OK.
  • If the file can’t be read, the app gets a 502 whose body starts zhttp could not read the file this response is mapped to:, followed by the reason.

Map rules are saved with the session, like breakpoints.