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

Fix HTTPS uploads #438

Merged
merged 2 commits into from Aug 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions SmartDeviceLink/SDLURLSession.m
Expand Up @@ -76,13 +76,13 @@ - (void)dataFromURL:(NSURL *)url completionHandler:(SDLURLConnectionRequestCompl
}

- (void)uploadWithURLRequest:(NSURLRequest *)request data:(NSData *)data completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler {
NSURL *newURL = nil;
if ([request.URL.scheme isEqualToString:@"http"]) {
newURL = [NSURL URLWithString:[request.URL.absoluteString stringByReplacingCharactersInRange:NSMakeRange(0, 4) withString:@"https"]];
NSURL *url = request.URL;
if ([url.scheme isEqualToString:@"http"]) {
url = [NSURL URLWithString:[url.absoluteString stringByReplacingCharactersInRange:NSMakeRange(0, 4) withString:@"https"]];
}

NSMutableURLRequest *mutableRequest = [request mutableCopy];
mutableRequest.URL = newURL;
mutableRequest.URL = url;
mutableRequest.HTTPBody = data;
mutableRequest.HTTPMethod = @"POST";

Expand Down
Expand Up @@ -10,7 +10,7 @@
__block SDLURLSession *testSession = nil;

describe(@"attempting to get good data", ^{
context(@"from an http address", ^{
context(@"from an https address", ^{
context(@"uploading data", ^{
NSData *testData = [@"testData" dataUsingEncoding:NSUTF8StringEncoding];
NSArray *someJSONObject = @[@"one", @"two"];
Expand Down