mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-11 09:11:14 +08:00
[ReactNative] Allow uploading native files (e.g. photos) and FormData via XMLHttpRequest
This commit is contained in:
39
Libraries/Network/RCTHTTPQueryExecutor.h
Normal file
39
Libraries/Network/RCTHTTPQueryExecutor.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "RCTDataQuery.h"
|
||||
|
||||
@interface RCTHTTPQueryExecutor : NSObject <RCTDataQueryExecutor>
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
/**
|
||||
* Process the 'data' part of an HTTP query.
|
||||
*
|
||||
* 'data' can be a JSON value of the following forms:
|
||||
*
|
||||
* - {"string": "..."}: a simple JS string that will be UTF-8 encoded and sent as the body
|
||||
*
|
||||
* - {"uri": "some-uri://..."}: reference to a system resource, e.g. an image in the asset library
|
||||
*
|
||||
* - {"formData": [...]}: list of data payloads that will be combined into a multipart/form-data request
|
||||
*
|
||||
* If successful, the callback be called with a result dictionary containing the following (optional) keys:
|
||||
*
|
||||
* - @"body" (NSData): the body of the request
|
||||
*
|
||||
* - @"contentType" (NSString): the content type header of the request
|
||||
*
|
||||
*/
|
||||
+ (void)processDataForHTTPQuery:(NSDictionary *)data
|
||||
callback:(void (^)(NSError *error, NSDictionary *result))callback;
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user