@@ -10,20 +10,20 @@ interface and is therefore an [EventEmitter][event-emitter].
10
10
11
11
### ` new ClientRequest(options) `
12
12
13
- * ` options ` (Object | String ) - If ` options ` is a String , it is interpreted as
13
+ * ` options ` (Object | string ) - If ` options ` is a string , it is interpreted as
14
14
the request URL. If it is an object, it is expected to fully specify an HTTP request via the
15
15
following properties:
16
- * ` method ` String (optional) - The HTTP request method. Defaults to the GET
16
+ * ` method ` string (optional) - The HTTP request method. Defaults to the GET
17
17
method.
18
- * ` url ` String (optional) - The request URL. Must be provided in the absolute
18
+ * ` url ` string (optional) - The request URL. Must be provided in the absolute
19
19
form with the protocol scheme specified as http or https.
20
20
* ` session ` Session (optional) - The [ ` Session ` ] ( session.md ) instance with
21
21
which the request is associated.
22
- * ` partition ` String (optional) - The name of the [ ` partition ` ] ( session.md )
22
+ * ` partition ` string (optional) - The name of the [ ` partition ` ] ( session.md )
23
23
with which the request is associated. Defaults to the empty string. The
24
24
` session ` option supersedes ` partition ` . Thus if a ` session ` is explicitly
25
25
specified, ` partition ` is ignored.
26
- * ` credentials ` String (optional) - Can be ` include ` or ` omit ` . Whether to
26
+ * ` credentials ` string (optional) - Can be ` include ` or ` omit ` . Whether to
27
27
send [ credentials] ( https://fetch.spec.whatwg.org/#credentials ) with this
28
28
request. If set to ` include ` , credentials from the session associated with
29
29
the request will be used. If set to ` omit ` , credentials will not be sent
@@ -33,22 +33,22 @@ following properties:
33
33
option of the same name. If this option is not specified, authentication
34
34
data from the session will be sent, and cookies will not be sent (unless
35
35
` useSessionCookies ` is set).
36
- * ` useSessionCookies ` Boolean (optional) - Whether to send cookies with this
36
+ * ` useSessionCookies ` boolean (optional) - Whether to send cookies with this
37
37
request from the provided session. If ` credentials ` is specified, this
38
38
option has no effect. Default is ` false ` .
39
- * ` protocol ` String (optional) - Can be ` http: ` or ` https: ` . The protocol
39
+ * ` protocol ` string (optional) - Can be ` http: ` or ` https: ` . The protocol
40
40
scheme in the form 'scheme:'. Defaults to 'http:'.
41
- * ` host ` String (optional) - The server host provided as a concatenation of
41
+ * ` host ` string (optional) - The server host provided as a concatenation of
42
42
the hostname and the port number 'hostname: port '.
43
- * ` hostname ` String (optional) - The server host name.
43
+ * ` hostname ` string (optional) - The server host name.
44
44
* ` port ` Integer (optional) - The server's listening port number.
45
- * ` path ` String (optional) - The path part of the request URL.
46
- * ` redirect ` String (optional) - Can be ` follow ` , ` error ` or ` manual ` . The
45
+ * ` path ` string (optional) - The path part of the request URL.
46
+ * ` redirect ` string (optional) - Can be ` follow ` , ` error ` or ` manual ` . The
47
47
redirect mode for this request. When mode is ` error ` , any redirection will
48
48
be aborted. When mode is ` manual ` the redirection will be cancelled unless
49
49
[ ` request.followRedirect ` ] ( #requestfollowredirect ) is invoked synchronously
50
50
during the [ ` redirect ` ] ( #event-redirect ) event. Defaults to ` follow ` .
51
- * ` origin ` String (optional) - The origin URL of the request.
51
+ * ` origin ` string (optional) - The origin URL of the request.
52
52
53
53
` options ` properties such as ` protocol ` , ` host ` , ` hostname ` , ` port ` and ` path `
54
54
strictly follow the Node.js model as described in the
@@ -79,21 +79,21 @@ Returns:
79
79
Returns:
80
80
81
81
* ` authInfo ` Object
82
- * ` isProxy ` Boolean
83
- * ` scheme ` String
84
- * ` host ` String
82
+ * ` isProxy ` boolean
83
+ * ` scheme ` string
84
+ * ` host ` string
85
85
* ` port ` Integer
86
- * ` realm ` String
86
+ * ` realm ` string
87
87
* ` callback ` Function
88
- * ` username ` String (optional)
89
- * ` password ` String (optional)
88
+ * ` username ` string (optional)
89
+ * ` password ` string (optional)
90
90
91
91
Emitted when an authenticating proxy is asking for user credentials.
92
92
93
93
The ` callback ` function is expected to be called back with user credentials:
94
94
95
- * ` username ` String
96
- * ` password ` String
95
+ * ` username ` string
96
+ * ` password ` string
97
97
98
98
``` JavaScript
99
99
request .on (' login' , (authInfo , callback ) => {
@@ -147,9 +147,9 @@ event indicates that no more events will be emitted on either the `request` or
147
147
Returns:
148
148
149
149
* ` statusCode ` Integer
150
- * ` method ` String
151
- * ` redirectUrl ` String
152
- * ` responseHeaders ` Record<String, String [ ] >
150
+ * ` method ` string
151
+ * ` redirectUrl ` string
152
+ * ` responseHeaders ` Record<string, string [ ] >
153
153
154
154
Emitted when the server returns a redirect response (e.g. 301 Moved
155
155
Permanently). Calling [ ` request.followRedirect ` ] ( #requestfollowredirect ) will
@@ -161,7 +161,7 @@ continue with the redirection. If this event is handled,
161
161
162
162
#### ` request.chunkedEncoding `
163
163
164
- A ` Boolean ` specifying whether the request will use HTTP chunked transfer encoding
164
+ A ` boolean ` specifying whether the request will use HTTP chunked transfer encoding
165
165
or not. Defaults to false. The property is readable and writable, however it can
166
166
be set only before the first write operation as the HTTP headers are not yet put
167
167
on the wire. Trying to set the ` chunkedEncoding ` property after the first write
@@ -175,12 +175,12 @@ internally buffered inside Electron process memory.
175
175
176
176
#### ` request.setHeader(name, value) `
177
177
178
- * ` name ` String - An extra HTTP header name.
179
- * ` value ` String - An extra HTTP header value.
178
+ * ` name ` string - An extra HTTP header name.
179
+ * ` value ` string - An extra HTTP header value.
180
180
181
181
Adds an extra HTTP header. The header name will be issued as-is without
182
182
lowercasing. It can be called only before first write. Calling this method after
183
- the first write will throw an error. If the passed value is not a ` String ` , its
183
+ the first write will throw an error. If the passed value is not a ` string ` , its
184
184
` toString() ` method will be called to obtain the final value.
185
185
186
186
Certain headers are restricted from being set by apps. These headers are
@@ -199,22 +199,22 @@ Additionally, setting the `Connection` header to the value `upgrade` is also dis
199
199
200
200
#### ` request.getHeader(name) `
201
201
202
- * ` name ` String - Specify an extra header name.
202
+ * ` name ` string - Specify an extra header name.
203
203
204
- Returns ` String ` - The value of a previously set extra header name.
204
+ Returns ` string ` - The value of a previously set extra header name.
205
205
206
206
#### ` request.removeHeader(name) `
207
207
208
- * ` name ` String - Specify an extra header name.
208
+ * ` name ` string - Specify an extra header name.
209
209
210
210
Removes a previously set extra header name. This method can be called only
211
211
before first write. Trying to call it after the first write will throw an error.
212
212
213
213
#### ` request.write(chunk[, encoding][, callback]) `
214
214
215
- * ` chunk ` (String | Buffer) - A chunk of the request body's data. If it is a
215
+ * ` chunk ` (string | Buffer) - A chunk of the request body's data. If it is a
216
216
string, it is converted into a Buffer using the specified encoding.
217
- * ` encoding ` String (optional) - Used to convert string chunks into Buffer
217
+ * ` encoding ` string (optional) - Used to convert string chunks into Buffer
218
218
objects. Defaults to 'utf-8'.
219
219
* ` callback ` Function (optional) - Called after the write operation ends.
220
220
@@ -230,8 +230,8 @@ it is not allowed to add or remove a custom header.
230
230
231
231
#### ` request.end([chunk][, encoding][, callback]) `
232
232
233
- * ` chunk ` (String | Buffer) (optional)
234
- * ` encoding ` String (optional)
233
+ * ` chunk ` (string | Buffer) (optional)
234
+ * ` encoding ` string (optional)
235
235
* ` callback ` Function (optional)
236
236
237
237
Sends the last chunk of the request data. Subsequent write or end operations
@@ -253,9 +253,9 @@ event.
253
253
254
254
Returns ` Object ` :
255
255
256
- * ` active ` Boolean - Whether the request is currently active. If this is false
256
+ * ` active ` boolean - Whether the request is currently active. If this is false
257
257
no other properties will be set
258
- * ` started ` Boolean - Whether the upload has started. If this is false both
258
+ * ` started ` boolean - Whether the upload has started. If this is false both
259
259
` current ` and ` total ` will be set to 0.
260
260
* ` current ` Integer - The number of bytes that have been uploaded so far
261
261
* ` total ` Integer - The number of bytes that will be uploaded this request
0 commit comments