docs: Correct doc for registerFileProtocol (#18022)

In the registerFileProtocol docs the "headers" argument of the callback was described as being a list. In fact is has to be an Object mapping header-entries to values. This can be seen in Line 326 of `/spec/api-protocol-spec.js` [fe618631f1/spec/api-protocol-spec.js (L326)].
This commit is contained in:
pathim 2019-04-30 00:26:55 +02:00 committed by Shelley Vohr
parent 2fd3029040
commit cc1e8ecef6

View file

@ -148,8 +148,8 @@ 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 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 path or an object that has a `path` property, e.g. `callback(filePath)` or
`callback({ path: filePath })`. The object may also have a `headers` property `callback({ path: filePath })`. The object may also have a `headers` property
which gives a list of strings for the response headers, e.g. which gives a map of headers to values for the response headers, e.g.
`callback({ path: filePath, headers: ["Content-Security-Policy: default-src 'none'"]})`. `callback({ path: filePath, headers: {"Content-Security-Policy": "default-src 'none'"]})`.
When `callback` is called with nothing, a number, or an object that has an 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 `error` property, the `request` will fail with the `error` number you