Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 13c6d92

Browse files
committed
code refactor
1 parent a7dab12 commit 13c6d92

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,7 @@ function fetch(...args:any):Promise {
172172
delete promise['uploadProgress']
173173
delete promise['stateChange']
174174
delete promise['cancel']
175-
promise.cancel = () => {
176-
console.warn('finished request could not be canceled')
177-
}
175+
promise.cancel = () => {}
178176

179177
if(err)
180178
reject(new Error(err, respInfo))

src/ios/RNFetchBlobFS.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ + (BOOL) mkdir:(NSString *) path {
390390
# pragma mark - stat
391391

392392
+ (NSDictionary *) stat:(NSString *) path error:(NSError **) error {
393-
NSMutableDictionary *stat = [[NSMutableDictionary alloc] init];
393+
394394
BOOL isDir = NO;
395395
NSFileManager * fm = [NSFileManager defaultManager];
396396
if([fm fileExistsAtPath:path isDirectory:&isDir] == NO) {
@@ -407,7 +407,8 @@ + (NSDictionary *) stat:(NSString *) path error:(NSError **) error {
407407
@"path" : path,
408408
@"lastModified" : [NSString stringWithFormat:@"%d", [lastModified timeIntervalSince1970]],
409409
@"type" : isDir ? @"directory" : @"file"
410-
};
410+
};
411+
411412
}
412413

413414
# pragma mark - exists

test/test-xmlhttp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ describe('request headers records should be cleared by open()', (report, done) =
157157
if(this.readyState == 4) {
158158
report(<Assert key="headers should be cleared by open()"
159159
expect={"200"}
160-
actual={this.response.value}/>)
160+
actual={JSON.parse(this.response).value}/>)
161161
done()
162162
}
163163
}
@@ -243,7 +243,7 @@ describe('upload progress event test', (report, done) => {
243243
report(
244244
<Assert key="reponse should correct"
245245
expect={time}
246-
actual={Math.floor(xhr.response.time)}/>,
246+
actual={Math.floor(JSON.parse(xhr.response).time)}/>,
247247
<Assert key="responseType should correct"
248248
expect={'json'}
249249
actual={xhr.responseType}/>)

0 commit comments

Comments
 (0)