Map to file
Map to file sends the app a file from your disk as the body of a response.
Add one
Section titled “Add one”- 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.
What the app gets
Section titled “What the app gets”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-Encodingis removed andCache-Control: no-storeis 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 Modifiedbecomes200 OK. - If the file can’t be read, the app gets a
502whose body startszhttp could not read the file this response is mapped to:, followed by the reason.
Map rules are saved with the session, like breakpoints.