X Tutup
Skip to content

Commit ec8697b

Browse files
authored
test: move protocol specs to main process (electron#18923)
1 parent fdb2502 commit ec8697b

File tree

9 files changed

+309
-333
lines changed

9 files changed

+309
-333
lines changed

docs/api/protocol.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,12 @@ protocol.registerSchemesAsPrivileged([
131131
* `handler` Function
132132
* `request` Object
133133
* `url` String
134+
* `headers` Record<String, String>
134135
* `referrer` String
135136
* `method` String
136137
* `uploadData` [UploadData[]](structures/upload-data.md)
137138
* `callback` Function
138-
* `filePath` String (optional)
139+
* `filePath` String | [FilePathWithHeaders](structures/file-path-with-headers.md) (optional)
139140
* `completion` Function (optional)
140141
* `error` Error
141142

@@ -165,6 +166,7 @@ than protocols that follow the "generic URI syntax" like `file:`.
165166
* `handler` Function
166167
* `request` Object
167168
* `url` String
169+
* `headers` Record<String, String>
168170
* `referrer` String
169171
* `method` String
170172
* `uploadData` [UploadData[]](structures/upload-data.md)
@@ -197,11 +199,12 @@ protocol.registerBufferProtocol('atom', (request, callback) => {
197199
* `handler` Function
198200
* `request` Object
199201
* `url` String
202+
* `headers` Record<String, String>
200203
* `referrer` String
201204
* `method` String
202205
* `uploadData` [UploadData[]](structures/upload-data.md)
203206
* `callback` Function
204-
* `data` String (optional)
207+
* `data` (String | [StringProtocolResponse](structures/string-protocol-response.md)) (optional)
205208
* `completion` Function (optional)
206209
* `error` Error
207210

@@ -217,14 +220,14 @@ should be called with either a `String` or an object that has the `data`,
217220
* `handler` Function
218221
* `request` Object
219222
* `url` String
220-
* `headers` Object
223+
* `headers` Record<String, String>
221224
* `referrer` String
222225
* `method` String
223226
* `uploadData` [UploadData[]](structures/upload-data.md)
224227
* `callback` Function
225228
* `redirectRequest` Object
226229
* `url` String
227-
* `method` String
230+
* `method` String (optional)
228231
* `session` Object (optional)
229232
* `uploadData` Object (optional)
230233
* `contentType` String - MIME type of the content.
@@ -249,7 +252,7 @@ For POST requests the `uploadData` object must be provided.
249252
* `handler` Function
250253
* `request` Object
251254
* `url` String
252-
* `headers` Object
255+
* `headers` Record<String, String>
253256
* `referrer` String
254257
* `method` String
255258
* `uploadData` [UploadData[]](structures/upload-data.md)
@@ -325,6 +328,7 @@ already a handler for `scheme`.
325328
* `handler` Function
326329
* `request` Object
327330
* `url` String
331+
* `headers` Record<String, String>
328332
* `referrer` String
329333
* `method` String
330334
* `uploadData` [UploadData[]](structures/upload-data.md)
@@ -342,11 +346,12 @@ which sends a file as a response.
342346
* `handler` Function
343347
* `request` Object
344348
* `url` String
349+
* `headers` Record<String, String>
345350
* `referrer` String
346351
* `method` String
347352
* `uploadData` [UploadData[]](structures/upload-data.md)
348353
* `callback` Function
349-
* `data` String (optional)
354+
* `data` (String | [StringProtocolResponse](structures/string-protocol-response.md)) (optional)
350355
* `completion` Function (optional)
351356
* `error` Error
352357

@@ -359,6 +364,7 @@ which sends a `String` as a response.
359364
* `handler` Function
360365
* `request` Object
361366
* `url` String
367+
* `headers` Record<String, String>
362368
* `referrer` String
363369
* `method` String
364370
* `uploadData` [UploadData[]](structures/upload-data.md)
@@ -376,15 +382,15 @@ which sends a `Buffer` as a response.
376382
* `handler` Function
377383
* `request` Object
378384
* `url` String
379-
* `headers` Object
385+
* `headers` Record<String, String>
380386
* `referrer` String
381387
* `method` String
382388
* `uploadData` [UploadData[]](structures/upload-data.md)
383389
* `callback` Function
384390
* `redirectRequest` Object
385391
* `url` String
386-
* `method` String
387-
* `session` Object (optional)
392+
* `method` String (optional)
393+
* `session` Object | null (optional)
388394
* `uploadData` Object (optional)
389395
* `contentType` String - MIME type of the content.
390396
* `data` String - Content to be sent.
@@ -400,7 +406,7 @@ which sends a new HTTP request as a response.
400406
* `handler` Function
401407
* `request` Object
402408
* `url` String
403-
* `headers` Object
409+
* `headers` Record<String, String>
404410
* `referrer` String
405411
* `method` String
406412
* `uploadData` [UploadData[]](structures/upload-data.md)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# FilePathWithHeaders Object
2+
3+
* `path` String - The path to the file to send.
4+
* `headers` Record<string, string> (optional) - Additional headers to be sent.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# StreamProtocolResponse Object
22

3-
* `statusCode` Number - The HTTP response code.
4-
* `headers` Object - An object containing the response headers.
5-
* `data` ReadableStream - A Node.js readable stream representing the response body.
3+
* `statusCode` Number (optional) - The HTTP response code.
4+
* `headers` Record<String, String | String[]> (optional) - An object containing the response headers.
5+
* `data` ReadableStream | null - A Node.js readable stream representing the response body.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# StringProtocolResponse Object
2+
3+
* `mimeType` String (optional) - MIME type of the response.
4+
* `charset` String (optional) - Charset of the response.
5+
* `data` String | null - A string representing the response body.

docs/api/structures/upload-data.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# UploadData Object
22

3+
* `contentType` String (optional) - Content type of the content to be sent.
34
* `bytes` Buffer - Content being sent.
4-
* `file` String - Path of file being uploaded.
5-
* `blobUUID` String - UUID of blob data. Use [ses.getBlobData](../session.md#sesgetblobdataidentifier method
5+
* `file` String (optional) - Path of file being uploaded.
6+
* `blobUUID` String (optional) - UUID of blob data. Use [ses.getBlobData](../session.md#sesgetblobdataidentifier) method
67
to retrieve the data.

filenames.auto.gni

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ auto_filenames = {
7575
"docs/api/structures/display.md",
7676
"docs/api/structures/event.md",
7777
"docs/api/structures/file-filter.md",
78+
"docs/api/structures/file-path-with-headers.md",
7879
"docs/api/structures/gpu-feature-status.md",
7980
"docs/api/structures/io-counters.md",
8081
"docs/api/structures/ipc-main-event.md",
@@ -100,6 +101,7 @@ auto_filenames = {
100101
"docs/api/structures/shortcut-details.md",
101102
"docs/api/structures/size.md",
102103
"docs/api/structures/stream-protocol-response.md",
104+
"docs/api/structures/string-protocol-response.md",
103105
"docs/api/structures/task.md",
104106
"docs/api/structures/thumbar-button.md",
105107
"docs/api/structures/trace-categories-and-options.md",

0 commit comments

Comments
 (0)
X Tutup