Implemented normalizeHttpPath option - #90
Conversation
|
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
|
See: strongloop/loopback#433 for LB integration |
|
@ritch @raymondfeng this is currently a blocking issue for me - AFAIK there's no good way to change the remoting path of the base models, and frankly having non-normalized paths in urls is just unacceptable to me; it should never have slipped into LB 2.0 in the first place IMHO: /Users ??? |
|
I think we need to support url formats instead of a flag to normalize URLs this way. This is what I am thinking... function RemoteObjects() {
// ...
this.addFormat({
for: 'url',
name: 'dashed'
}, function(original) {
return dasherize(lowercase(original));
});
// ...
}
// usage (eg in a loopback app)
app.remotes().format('url', 'dashed');
// custom style
app.remotes().addFormat('url', 'my style', myFormatFn);
// we can also make other things format-able in the same way (note: different arg style)
app.remotes().addFormat('response body', 'namespaced', function(body) {
return {
myNamespace: body
};
}); |
|
@ritch +1 although I would be just as happy with: // usage (eg in a loopback app)
app.remotes({ formatting: { url: 'dashed' } }); |
|
Since none of us have time to implement the version with all bells and whistles, I am proposing to go with the solution proposed by @fabien. It is flexible enough in the sense that it can be easily extended to support a function value of Another pro of this patch is that the rest transport will finally have an |
|
@fabien Can you rebase? |
|
@raymondfeng rebased (sorry for the double commit there) |
4d752bd to
7a46b05
Compare
|
Any objections if I merge it? |
I don't have any objections. |
Implemented normalizeHttpPath option
See previous discussion: loopbackio/loopback-datasource-juggler#199