You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added TypeScript declarations for FormStream methods (headers, file,
field).
* **Chores**
* Enforced pnpm@10.24.0 and started versioning pnpm-lock.yaml.
* Added formatting/typecheck scripts (fmt, fmtcheck, typecheck) and
oxfmt dev dependency.
* CI/workflow and formatter configuration updated for consistent
formatting and quality checks.
* **Documentation**
* README formatting updated for improved argument styling.
<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Copy file name to clipboardExpand all lines: README.md
+24-24Lines changed: 24 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,30 +56,30 @@ console.log('status: %s, body size: %d, headers: %j', res.status, data.length, r
56
56
#### Arguments
57
57
58
58
-**url** String | Object - The URL to request, either a String or a Object that return by [url.parse](https://nodejs.org/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost).
59
-
-***options*** Object - Optional
60
-
-***method*** String - Request method, defaults to `GET`. Could be `GET`, `POST`, `DELETE` or `PUT`. Alias 'type'.
61
-
-***data*** Object - Data to be sent. Will be stringify automatically.
62
-
-***content*** String | [Buffer](https://nodejs.org/api/buffer.html) - Manually set the content of payload. If set, `data` will be ignored.
63
-
-***stream***[stream.Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable) - Stream to be pipe to the remote. If set, `data` and `content` will be ignored.
64
-
-***writeStream***[stream.Writable](https://nodejs.org/api/stream.html#stream_class_stream_writable) - A writable stream to be piped by the response stream. Responding data will be write to this stream and `callback` will be called with `data` set `null` after finished writing.
65
-
-***files*** {Array<ReadStream|Buffer|String> | Object | ReadStream | Buffer | String - The files will send with `multipart/form-data` format, base on `formstream`. If `method` not set, will use `POST` method by default.
66
-
-***contentType*** String - Type of request data. Could be `json` (**Notes**: not use `application/json` here). If it's `json`, will auto set `Content-Type: application/json` header.
67
-
-***dataType*** String - Type of response data. Could be `text` or `json`. If it's `text`, the `callback`ed `data` would be a String. If it's `json`, the `data` of callback would be a parsed JSON Object and will auto set `Accept: application/json` header. Default `callback`ed `data` would be a `Buffer`.
68
-
-***fixJSONCtlChars*** Boolean - Fix the control characters (U+0000 through U+001F) before JSON parse response. Default is `false`.
69
-
-***headers*** Object - Request headers.
70
-
-***timeout*** Number | Array - Request timeout in milliseconds for connecting phase and response receiving phase. Default is `5000`. You can use `timeout: 5000` to tell urllib use same timeout on two phase or set them separately such as `timeout: [3000, 5000]`, which will set connecting timeout to 3s and response 5s.
71
-
-***keepAliveTimeout***`number | null` - Default is `4000`, 4 seconds - The timeout after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. See [MDN: HTTP - Headers - Keep-Alive directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive#directives) for more details.
72
-
-***auth*** String - `username:password` used in HTTP Basic Authorization.
73
-
-***digestAuth*** String - `username:password` used in HTTP [Digest Authorization](https://en.wikipedia.org/wiki/Digest_access_authentication).
74
-
-***followRedirect*** Boolean - follow HTTP 3xx responses as redirects. defaults to true.
75
-
-***maxRedirects*** Number - The maximum number of redirects to follow, defaults to 10.
76
-
-***formatRedirectUrl*** Function - Format the redirect url by yourself. Default is `url.resolve(from, to)`.
77
-
-***beforeRequest*** Function - Before request hook, you can change every thing here.
78
-
-***streaming*** Boolean - lets you get the `res` object when request connected, default `false`. alias `customResponse`
79
-
-***compressed*** Boolean - Accept `gzip, br` response content and auto decode it, default is `false`.
80
-
-***timing*** Boolean - Enable timing or not, default is `true`.
81
-
-***socketPath*** String | null - request a unix socket service, default is `null`.
82
-
-***highWaterMark*** Number - default is `67108864`, 64 KiB.
59
+
-**_options_** Object - Optional
60
+
-**_method_** String - Request method, defaults to `GET`. Could be `GET`, `POST`, `DELETE` or `PUT`. Alias 'type'.
61
+
-**_data_** Object - Data to be sent. Will be stringify automatically.
62
+
-**_content_** String | [Buffer](https://nodejs.org/api/buffer.html) - Manually set the content of payload. If set, `data` will be ignored.
63
+
-**_stream_**[stream.Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable) - Stream to be pipe to the remote. If set, `data` and `content` will be ignored.
64
+
-**_writeStream_**[stream.Writable](https://nodejs.org/api/stream.html#stream_class_stream_writable) - A writable stream to be piped by the response stream. Responding data will be write to this stream and `callback` will be called with `data` set `null` after finished writing.
65
+
-**_files_** {Array<ReadStream|Buffer|String> | Object | ReadStream | Buffer | String - The files will send with `multipart/form-data` format, base on `formstream`. If `method` not set, will use `POST` method by default.
66
+
-**_contentType_** String - Type of request data. Could be `json` (**Notes**: not use `application/json` here). If it's `json`, will auto set `Content-Type: application/json` header.
67
+
-**_dataType_** String - Type of response data. Could be `text` or `json`. If it's `text`, the `callback`ed `data` would be a String. If it's `json`, the `data` of callback would be a parsed JSON Object and will auto set `Accept: application/json` header. Default `callback`ed `data` would be a `Buffer`.
68
+
-**_fixJSONCtlChars_** Boolean - Fix the control characters (U+0000 through U+001F) before JSON parse response. Default is `false`.
69
+
-**_headers_** Object - Request headers.
70
+
-**_timeout_** Number | Array - Request timeout in milliseconds for connecting phase and response receiving phase. Default is `5000`. You can use `timeout: 5000` to tell urllib use same timeout on two phase or set them separately such as `timeout: [3000, 5000]`, which will set connecting timeout to 3s and response 5s.
71
+
-**_keepAliveTimeout_**`number | null` - Default is `4000`, 4 seconds - The timeout after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by _keep-alive_ hints from the server. See [MDN: HTTP - Headers - Keep-Alive directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive#directives) for more details.
72
+
-**_auth_** String - `username:password` used in HTTP Basic Authorization.
73
+
-**_digestAuth_** String - `username:password` used in HTTP [Digest Authorization](https://en.wikipedia.org/wiki/Digest_access_authentication).
74
+
-**_followRedirect_** Boolean - follow HTTP 3xx responses as redirects. defaults to true.
75
+
-**_maxRedirects_** Number - The maximum number of redirects to follow, defaults to 10.
76
+
-**_formatRedirectUrl_** Function - Format the redirect url by yourself. Default is `url.resolve(from, to)`.
77
+
-**_beforeRequest_** Function - Before request hook, you can change every thing here.
78
+
-**_streaming_** Boolean - lets you get the `res` object when request connected, default `false`. alias `customResponse`
79
+
-**_compressed_** Boolean - Accept `gzip, br` response content and auto decode it, default is `false`.
80
+
-**_timing_** Boolean - Enable timing or not, default is `true`.
81
+
-**_socketPath_** String | null - request a unix socket service, default is `null`.
82
+
-**_highWaterMark_** Number - default is `67108864`, 64 KiB.
0 commit comments