зеркало из https://github.com/electron/electron.git
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:
Родитель
2fd3029040
Коммит
cc1e8ecef6
|
@ -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
|
||||
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
|
||||
which gives a list of strings for the response headers, e.g.
|
||||
`callback({ path: filePath, headers: ["Content-Security-Policy: default-src 'none'"]})`.
|
||||
which gives a map of headers to values 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
|
||||
|
|
Загрузка…
Ссылка в новой задаче