Skip to content

Instantly share code, notes, and snippets.

@lholmquist
Created November 14, 2012 14:59
Show Gist options
  • Save lholmquist/4072589 to your computer and use it in GitHub Desktop.
Save lholmquist/4072589 to your computer and use it in GitHub Desktop.
Trailing slash
//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