amiel/ember-data-url-templates

Namespace is escaped

graup opened this issue · 8 comments

graup commented

(Sorry, this should probably be in an issue and not a PR)

I just ran into the problem that the "namespace" part of the URL is escaped. This makes it impossible to use namespaces like api/v1/... with this.

I "fixed" the original test to demonstrate it is failing. #3

If you point me into the right direction I could also try and fix this.

graup commented

A temporary fix is to use /{+namespace} instead of {/namespace} but that's not really optimal. I guess this is a limiation of uri-templates (or for that matter, rfc6570).

amiel commented

@graup I think that {+namespace} would be a fine way to deal with this. What isn't optimal about it?

graup commented

And then just include the prefix slash in the namespace... I guess that works, yeah.

Should have thought more before posting. But maybe it will help someone else.
Thanks anyway :)

amiel commented

Nah, thanks for bringing it up. Do you think the library should default with {+namespace}?

graup commented

Well, currently the docs don't mention namespace at all, so it would definitely be helpful to at least talk about it.

But yes, I think it would be better if {+namespace} alongside {namespace: '/api'} was the default example.

amiel commented

Sounds like a good plan. Care to make the changes?

graup commented

Sure, I'll update the PR when I find the time! 😄

amiel commented

Thanks!