Browse Source

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` [https://github.com/electron/electron/blob/fe618631f1e6858077874226682fa299d1700b36/spec/api-protocol-spec.js#L326].
pathim 6 years ago
parent
commit
cc1e8ecef6
1 changed files with 2 additions and 2 deletions
  1. 2 2
      docs/api/protocol.md

+ 2 - 2
docs/api/protocol.md

@@ -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