urllib 3.22.3 → 3.22.4

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.
@@ -68,7 +68,7 @@ class BlobFromStream {
68
68
  return 'Blob';
69
69
  }
70
70
  }
71
- exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.22.3');
71
+ exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.22.4');
72
72
  function getFileName(stream) {
73
73
  const filePath = stream.path;
74
74
  if (filePath) {
@@ -160,7 +160,7 @@ class HttpClient extends node_events_1.EventEmitter {
160
160
  requestUrl = new URL(url.toString());
161
161
  }
162
162
  }
163
- const method = (options?.method ?? 'GET').toUpperCase();
163
+ const method = (options?.type || options?.method || 'GET').toUpperCase();
164
164
  const originalHeaders = options?.headers;
165
165
  const headers = {};
166
166
  const args = {
@@ -12,6 +12,8 @@ export type FixJSONCtlChars = boolean | FixJSONCtlCharsHandler;
12
12
  export type RequestOptions = {
13
13
  /** Request method, defaults to GET. Could be GET, POST, DELETE or PUT. Alias 'type'. */
14
14
  method?: HttpMethod | Lowercase<HttpMethod>;
15
+ /** Alias for 'method'. */
16
+ type?: HttpMethod | Lowercase<HttpMethod>;
15
17
  /** Data to be sent. Will be stringify automatically. */
16
18
  data?: any;
17
19
  /** Manually set the content of payload. If set, data will be ignored. */
@@ -62,7 +62,7 @@ class BlobFromStream {
62
62
  return 'Blob';
63
63
  }
64
64
  }
65
- export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.22.3');
65
+ export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.22.4');
66
66
  function getFileName(stream) {
67
67
  const filePath = stream.path;
68
68
  if (filePath) {
@@ -154,7 +154,7 @@ export class HttpClient extends EventEmitter {
154
154
  requestUrl = new URL(url.toString());
155
155
  }
156
156
  }
157
- const method = (options?.method ?? 'GET').toUpperCase();
157
+ const method = (options?.type || options?.method || 'GET').toUpperCase();
158
158
  const originalHeaders = options?.headers;
159
159
  const headers = {};
160
160
  const args = {
@@ -12,6 +12,8 @@ export type FixJSONCtlChars = boolean | FixJSONCtlCharsHandler;
12
12
  export type RequestOptions = {
13
13
  /** Request method, defaults to GET. Could be GET, POST, DELETE or PUT. Alias 'type'. */
14
14
  method?: HttpMethod | Lowercase<HttpMethod>;
15
+ /** Alias for 'method'. */
16
+ type?: HttpMethod | Lowercase<HttpMethod>;
15
17
  /** Data to be sent. Will be stringify automatically. */
16
18
  data?: any;
17
19
  /** Manually set the content of payload. If set, data will be ignored. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "urllib",
3
- "version": "3.22.3",
3
+ "version": "3.22.4",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },
package/src/HttpClient.ts CHANGED
@@ -256,7 +256,7 @@ export class HttpClient extends EventEmitter {
256
256
  }
257
257
  }
258
258
 
259
- const method = (options?.method ?? 'GET').toUpperCase() as HttpMethod;
259
+ const method = (options?.type || options?.method || 'GET').toUpperCase() as HttpMethod;
260
260
  const originalHeaders = options?.headers;
261
261
  const headers: IncomingHttpHeaders = {};
262
262
  const args = {
package/src/Request.ts CHANGED
@@ -13,6 +13,8 @@ export type FixJSONCtlChars = boolean | FixJSONCtlCharsHandler;
13
13
  export type RequestOptions = {
14
14
  /** Request method, defaults to GET. Could be GET, POST, DELETE or PUT. Alias 'type'. */
15
15
  method?: HttpMethod | Lowercase<HttpMethod>;
16
+ /** Alias for 'method'. */
17
+ type?: HttpMethod | Lowercase<HttpMethod>;
16
18
  /** Data to be sent. Will be stringify automatically. */
17
19
  data?: any;
18
20
  /** Manually set the content of payload. If set, data will be ignored. */