On Thu, Apr 11, 2013 at 12:14 PM, Sebastien Blanc <scm.blanc(a)gmail.com>wrote:
Today when we set up a Pipe and call methods on it, we have a different
ways on how we can pass the stuff which are part of the URI and more
particularly the leading or ending "/" :
baseURL: "http://www.slackers.com" //no ending slash
endpoint: "/security" //we have to start with a slash
But we can also do it the otherr way around :
baseURL: "http://www.slackers.com/" //ending slash
endpoint: "security" //no starting slash
manipulation for ```baseURL``` and ```endpoint```.
But if you take the parameter ```id``` on the ```read``` function, this
one must not have a leading "/" because it's added by the library:
id: "team1" //works
id: "/team" //fails
assuming you want to access: http://www.slackers.com/security/team
expect that /team fails, since that would mean:
rid of the security part in the
Until now ```id``` was the last part of the URI but since we are planning
to add nested resources, ```id``` won't be necessarily the last fragment.
For example, we could have a new parameter called ```resource``` to be
appended at the end :
baseURL = "http://www.slackers.com/" //ending slash
endpoint: "security" // no starting slash
id: "5" // handled by lib
resource: "/crypto" //leading slash needed
As the spirit of Pipes (at least for REST) is to offer an abstraction
around the Ajax and URL handling plumbing code, I think we should have a
convention for passing URI fragments that is the same for all. My
suggestion is to do the same as for ```id``` : no leading ``` / ``` or
ending ``` / ```.
sounds right - however I guess the "resource" can be simply appended to the
underlying library, at least in iOS land this is easy:
NSURL *url = [NSURL URLWithString:@"http://server.com/security"];
url = [url URLByAppendingPathComponent:@"/foo/bar"];
If the user passes a leading or ending ``` / ```, the library will
removed it because it will be added implicitly. This way we are safe.
Remarks ? Questions ?
aerogear-dev mailing list