From cc1e8ecef6b79099d704e83e5de51162e5d7054e Mon Sep 17 00:00:00 2001 From: pathim Date: Tue, 30 Apr 2019 00:26:55 +0200 Subject: [PATCH] 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]. --- docs/api/protocol.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/protocol.md b/docs/api/protocol.md index 12073ca810d5..5282bbeef015 100644 --- a/docs/api/protocol.md +++ b/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