Skip to content

Commit

Permalink
checked for condition if port not present
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchiramoitra committed Jul 24, 2020
1 parent 59763cb commit 55cb09b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Rudder/Classes/RSConfigBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ - (instancetype) withEndPointUrl:(NSString *)endPointUrl{
config = [[RSConfig alloc] init];
}
NSURL *url = [[NSURL alloc] initWithString:endPointUrl];
if([url port]){
config.dataPlaneUrl = [[NSString alloc] initWithFormat:@"%@://%@:%@", [url scheme], [url host], [url port]];
}
else{
config.dataPlaneUrl = [[NSString alloc] initWithFormat:@"%@://%@", [url scheme], [url host]];
}
return self;
}

Expand All @@ -27,15 +32,24 @@ - (instancetype) withDataPlaneUrl: (NSString*) dataPlaneUrl {
}

NSURL *url = [[NSURL alloc] initWithString:dataPlaneUrl];
if([url port]){
config.dataPlaneUrl = [[NSString alloc] initWithFormat:@"%@://%@:%@", [url scheme], [url host], [url port]];
}else{
config.dataPlaneUrl = [[NSString alloc] initWithFormat:@"%@://%@", [url scheme], [url host]];
}
return self;
}

- (instancetype)withDataPlaneURL:(NSURL *) dataPlaneURL {
if (config == nil) {
config = [[RSConfig alloc] init];
}
if([dataPlaneURL port]){
config.dataPlaneUrl = [[NSString alloc] initWithFormat:@"%@://%@:%@", [dataPlaneURL scheme], [dataPlaneURL host] ,[dataPlaneURL port]];
}
else{
config.dataPlaneUrl = [[NSString alloc] initWithFormat:@"%@://%@", [dataPlaneURL scheme], [dataPlaneURL host]];
}
return self;
}

Expand Down

0 comments on commit 55cb09b

Please sign in to comment.