@jayfong/x-request 2.28.0 → 2.29.0
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/_cjs/index.js +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/lib/_cjs/index.js
CHANGED
|
@@ -147,7 +147,7 @@ class XRequest {
|
|
|
147
147
|
method: options.method || 'POST',
|
|
148
148
|
...(options.data == null ? {
|
|
149
149
|
body: ''
|
|
150
|
-
} : options.data instanceof _formData.default ? {
|
|
150
|
+
} : options.data instanceof _formData.default || Buffer.isBuffer(options.data) ? {
|
|
151
151
|
body: options.data
|
|
152
152
|
} : options.data instanceof URLSearchParams ? {
|
|
153
153
|
form: options.data
|
package/lib/index.d.ts
CHANGED
|
@@ -60,11 +60,11 @@ export interface XRequestGetOptions extends XRequestOptions {
|
|
|
60
60
|
}
|
|
61
61
|
export interface XRequestPostOptions extends XRequestOptions {
|
|
62
62
|
method?: string;
|
|
63
|
-
data?: Record<string, any> | FormData | URLSearchParams;
|
|
63
|
+
data?: Record<string, any> | FormData | URLSearchParams | Buffer;
|
|
64
64
|
}
|
|
65
65
|
export interface XRequestPostStreamOptions extends XRequestOptions {
|
|
66
66
|
method?: string;
|
|
67
|
-
data?: Record<string, any> | FormData | URLSearchParams | FormStream;
|
|
67
|
+
data?: Record<string, any> | FormData | URLSearchParams | Buffer | FormStream;
|
|
68
68
|
}
|
|
69
69
|
export declare class XRequestFormUrlencoded extends URLSearchParams {
|
|
70
70
|
}
|
package/lib/index.js
CHANGED
|
@@ -138,7 +138,7 @@ export class XRequest {
|
|
|
138
138
|
method: options.method || 'POST',
|
|
139
139
|
...(options.data == null ? {
|
|
140
140
|
body: ''
|
|
141
|
-
} : options.data instanceof FormData ? {
|
|
141
|
+
} : options.data instanceof FormData || Buffer.isBuffer(options.data) ? {
|
|
142
142
|
body: options.data
|
|
143
143
|
} : options.data instanceof URLSearchParams ? {
|
|
144
144
|
form: options.data
|