mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
FormData support added
This commit is contained in:
@@ -73,8 +73,8 @@ function buildJavaOptions(options: http.HttpRequestOptions) {
|
||||
if (types.isString(options.method)) {
|
||||
javaOptions.method = options.method;
|
||||
}
|
||||
if (options.content) {
|
||||
javaOptions.content = options.content;
|
||||
if (types.isString(options.content) || options.content instanceof FormData) {
|
||||
javaOptions.content = options.content.toString();
|
||||
}
|
||||
if (types.isNumber(options.timeout)) {
|
||||
javaOptions.timeout = options.timeout;
|
||||
|
||||
@@ -32,8 +32,8 @@ export function request(options: http.HttpRequestOptions): Promise<http.HttpResp
|
||||
}
|
||||
}
|
||||
|
||||
if (types.isString(options.content)) {
|
||||
urlRequest.HTTPBody = NSString.alloc().initWithString(options.content).dataUsingEncoding(4);
|
||||
if (types.isString(options.content) || options.content instanceof FormData) {
|
||||
urlRequest.HTTPBody = NSString.alloc().initWithString(options.content.toString()).dataUsingEncoding(4);
|
||||
}
|
||||
|
||||
if (types.isNumber(options.timeout)) {
|
||||
|
||||
2
http/http.d.ts
vendored
2
http/http.d.ts
vendored
@@ -69,7 +69,7 @@ declare module "http" {
|
||||
/**
|
||||
* Gets or sets the request body.
|
||||
*/
|
||||
content?: string;
|
||||
content?: string | FormData;
|
||||
|
||||
/**
|
||||
* Gets or sets the request timeout in milliseconds.
|
||||
|
||||
Reference in New Issue
Block a user