Created
November 14, 2012 14:59
-
-
Save lholmquist/4072589 to your computer and use it in GitHub Desktop.
Trailing slash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Taken from the AeroGearExample | |
tasksPipe = [todo pipe:^(id<AGPipeConfig> config) { | |
[config name:@"status"]; | |
[config endpoint: @"realm/status"]; //endpoint with no trailing slash | |
[config type:@"REST"]; | |
}]; | |
//when i do the read, i get a 404, since the URL has a trailing slash on it | |
[tasksPipe read:^(id responseObject) { | |
_tasks = responseObject; | |
[self.tableView reloadData]; | |
} failure:^(NSError *error) { | |
NSLog(@"An error has occured during fetch! \n%@", error); | |
}]; | |
//IN AGHttpClient | |
// Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected | |
//URL doesn't have the trailing slash yet | |
if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@"/"]) { | |
url = [url URLByAppendingPathComponent:@""]; | |
//URL now has the trailing slash | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment