API | Operation | Description |
Configuring a preflight request for cross-origin access | Sends a preflight request to check whether a real cross-origin access request can be sent |
QCloudOptionsObjectRequest* request = [[QCloudOptionsObjectRequest alloc] init];// Bucket name in the format: `BucketName-APPID`request.bucket =@"examplebucket-1250000000";// Set the origin domain, request method, and host for the CORS pre-flight request.request.origin = @"http://cloud.tencent.com";request.accessControlRequestMethod = @"GET";request.accessControlRequestHeaders = @"host";// Object key, i.e. the full path of a COS object. If the object is in a directory, the path should be "video/xxx/movie.mp4"request.object = @"exampleobject";[request setFinishBlock:^(id outputObject, NSError* error) {// outputObject contains information such as the ETag or custom headers in the response.NSDictionary* info = (NSDictionary *) outputObject;}];[[QCloudCOSXMLService defaultCOSXML] OptionsObject:request];
let optionsObject = QCloudOptionsObjectRequest.init();// Object key, i.e. the full path of a COS object. If the object is in a directory, the path should be "video/xxx/movie.mp4"optionsObject.object = "exampleobject";// Set the origin domain, request method, and headers for the CORS pre-flight request.optionsObject.origin = "http://www.qcloud.com";optionsObject.accessControlRequestMethod = "GET";optionsObject.accessControlRequestHeaders = "origin";// Bucket name in the format of BucketName-Appid, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucketoptionsObject.bucket = "examplebucket-1250000000";optionsObject.finishBlock = {(result,error) inif let result = result {// You can get the header information returned by the server from `result`}}QCloudCOSXMLService.defaultCOSXML().optionsObject(optionsObject);
Apakah halaman ini membantu?