@faasjs/request 0.0.2-beta.255 → 0.0.2-beta.256

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -56,7 +56,7 @@ export declare function querystringify(obj: any): string;
56
56
  * 发起网络请求
57
57
  * @param {string} url 请求路径或完整网址
58
58
  * @param {object=} [options={}] 参数和配置
59
- * @param {string} [options.methd=GET] 请求方法
59
+ * @param {string} [options.method=GET] 请求方法
60
60
  * @param {object} [options.query={}] 请求参数,放置于 path 后,若需放置在 body 中,请使用 body 参数
61
61
  * @param {object} [options.headers={}] 请求头
62
62
  * @param {object=} options.body 请求体
package/lib/index.es.js CHANGED
@@ -37,7 +37,7 @@ function querystringify(obj) {
37
37
  * 发起网络请求
38
38
  * @param {string} url 请求路径或完整网址
39
39
  * @param {object=} [options={}] 参数和配置
40
- * @param {string} [options.methd=GET] 请求方法
40
+ * @param {string} [options.method=GET] 请求方法
41
41
  * @param {object} [options.query={}] 请求参数,放置于 path 后,若需放置在 body 中,请使用 body 参数
42
42
  * @param {object} [options.headers={}] 请求头
43
43
  * @param {object=} options.body 请求体
@@ -77,7 +77,7 @@ async function request(url, { headers, method, query, body, timeout, auth, file,
77
77
  const uri = new URL(url);
78
78
  const protocol = uri.protocol === 'https:' ? https : http;
79
79
  if (!uri.protocol)
80
- throw Error('Unkonw protocol');
80
+ throw Error('Unknown protocol');
81
81
  const options = {
82
82
  headers: {},
83
83
  host: uri.host ? uri.host.replace(/:[0-9]+$/, '') : uri.host,
@@ -153,12 +153,12 @@ async function request(url, { headers, method, query, body, timeout, auth, file,
153
153
  if (file) {
154
154
  const crlf = '\r\n';
155
155
  const boundary = `--${Math.random().toString(16)}`;
156
- const delimeter = `${crlf}--${boundary}`;
156
+ const delimiter = `${crlf}--${boundary}`;
157
157
  const headers = [`Content-Disposition: form-data; name="file"; filename="${basename(file)}"${crlf}`];
158
158
  const multipartBody = Buffer.concat([
159
- Buffer.from(delimeter + crlf + headers.join('') + crlf),
159
+ Buffer.from(delimiter + crlf + headers.join('') + crlf),
160
160
  readFileSync(file),
161
- Buffer.from(`${delimeter}--`)
161
+ Buffer.from(`${delimiter}--`)
162
162
  ]);
163
163
  req.setHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
164
164
  req.setHeader('Content-Length', multipartBody.length);
package/lib/index.js CHANGED
@@ -62,7 +62,7 @@ function querystringify(obj) {
62
62
  * 发起网络请求
63
63
  * @param {string} url 请求路径或完整网址
64
64
  * @param {object=} [options={}] 参数和配置
65
- * @param {string} [options.methd=GET] 请求方法
65
+ * @param {string} [options.method=GET] 请求方法
66
66
  * @param {object} [options.query={}] 请求参数,放置于 path 后,若需放置在 body 中,请使用 body 参数
67
67
  * @param {object} [options.headers={}] 请求头
68
68
  * @param {object=} options.body 请求体
@@ -102,7 +102,7 @@ async function request(url$1, { headers, method, query, body, timeout, auth, fil
102
102
  const uri = new url.URL(url$1);
103
103
  const protocol = uri.protocol === 'https:' ? https__namespace : http__namespace;
104
104
  if (!uri.protocol)
105
- throw Error('Unkonw protocol');
105
+ throw Error('Unknown protocol');
106
106
  const options = {
107
107
  headers: {},
108
108
  host: uri.host ? uri.host.replace(/:[0-9]+$/, '') : uri.host,
@@ -178,12 +178,12 @@ async function request(url$1, { headers, method, query, body, timeout, auth, fil
178
178
  if (file) {
179
179
  const crlf = '\r\n';
180
180
  const boundary = `--${Math.random().toString(16)}`;
181
- const delimeter = `${crlf}--${boundary}`;
181
+ const delimiter = `${crlf}--${boundary}`;
182
182
  const headers = [`Content-Disposition: form-data; name="file"; filename="${path.basename(file)}"${crlf}`];
183
183
  const multipartBody = Buffer.concat([
184
- Buffer.from(delimeter + crlf + headers.join('') + crlf),
184
+ Buffer.from(delimiter + crlf + headers.join('') + crlf),
185
185
  fs.readFileSync(file),
186
- Buffer.from(`${delimeter}--`)
186
+ Buffer.from(`${delimiter}--`)
187
187
  ]);
188
188
  req.setHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
189
189
  req.setHeader('Content-Length', multipartBody.length);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/request",
3
- "version": "0.0.2-beta.255",
3
+ "version": "0.0.2-beta.256",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.es.js",
@@ -28,5 +28,5 @@
28
28
  "rollup-plugin-typescript2": "*",
29
29
  "typescript": "*"
30
30
  },
31
- "gitHead": "b44a8294ba8ed5b08cf56931f00e58fa9adfb6ce"
31
+ "gitHead": "92a5a276312a4229a0da806e195c9e4a843dfbc6"
32
32
  }