feat: Support response headers in File protocol handler (#16098)

* feat: Support response headers in File protocol handler

* bugfix: Null check headers value & fix tests

* refactor: Use non-deprecated FindKeyOfType
This commit is contained in:
David Baker 2018-12-19 06:17:02 +00:00 committed by Shelley Vohr
parent 03f876470e
commit cc85946f55
4 changed files with 44 additions and 10 deletions

View file

@ -99,7 +99,9 @@ going to be created with `scheme`. `completion` will be called with
To handle the `request`, the `callback` should be called with either the file's
path or an object that has a `path` property, e.g. `callback(filePath)` or
`callback({ path: filePath })`.
`callback({ path: filePath })`. The object may also have a `headers` property
which gives a list of strings for the response headers, e.g.
`callback({ path: filePath, headers: ["Content-Security-Policy: default-src 'none'"]})`.
When `callback` is called with nothing, a number, or an object that has an
`error` property, the `request` will fail with the `error` number you