Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nat-transfer ios端 headers无法传参 #58

Open
weenta opened this issue Nov 7, 2018 · 2 comments
Open

nat-transfer ios端 headers无法传参 #58

weenta opened this issue Nov 7, 2018 · 2 comments

Comments

@weenta
Copy link

weenta commented Nov 7, 2018

Nat.upload('http://uploader.示例.com', {
    path: 'file:///tmp/intapp/nat/sample/localFile',
    method: 'PUT',
    formData: {
        framework: 'weex/nat'
    },
    headers: {      // headers参数设置在ios端无效 (ios11.4)
        'x-app': 'nat/0.0.8',
        'x-sign': 'bfbbf4c1f087d972'
    }
}, {
    onProgress: (p) => {
        console.log('Progressing: ' + p)
    }
}, (err, ret) => {
    console.log(ret)
})

麻烦有时间的话帮忙看下,谢谢!

@muzin
Copy link

muzin commented Jan 6, 2019

你好,你可能需要修改一下 ios项目Pods NetTransfer -> NetTransfer.m ->uploadWithData函数中代码(在209行左右),
NSString boundary = [self md5:[@"nat" stringByAppendingFormat:@"%lf",[[NSDate date] timeIntervalSince1970]]];
//cookie
// NSDictionary
options = nil;
// BOOL trustAllHosts = [[command argumentAtIndex:6 withDefault:[NSNumber numberWithBool:YES]] boolValue]; // allow self-signed certs
NSDictionary* headers = params[@"headers"];
NSDictionary *formData = params[@"formData"];

if (params[@"filename"]) {
    filename = params[@"filename"];
}

原先:
NSDictionary* headers = params[@"header"];
正确代码:
NSDictionary* headers = params[@"headers"];

希望可以更正一下~~~Thank You~

@weenta
Copy link
Author

weenta commented Jan 6, 2019

@muzin Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants