Open nareshbhatia opened 10 years ago
@nareshbhatia I was thinking about how to implement this.
I'd need something to join http://haltalk.herokuapp.com/docs/{rel}
and /posts/latest
into http://haltalk.herokuapp.com/docs/posts/latest
. I guess there are some hidden rules there. A simple replace
would create two slashes between docs and posts. Are you using any link templating library? Do you have any to suggest? It might be a good idea to use it here instead of building something from scratch.
https://www.npmjs.org/package/uritemplate looks good, and has no dependencies.
That's interesting.
> require('uritemplate').parse('http://haltalk.herokuapp.com/docs/{rel}').expand({ rel: '/some/where' })
'http://haltalk.herokuapp.com/docs/%2Fsome%2Fwhere'
> require('uritemplate').parse('http://haltalk.herokuapp.com/docs/{+rel}').expand({ rel: '/some/where' })
'http://haltalk.herokuapp.com/docs//some/where'
Tested with https://www.npmjs.org/package/uri-template, too and it does the same thing.
And apparently, they are correct. See http://tools.ietf.org/html/rfc6570#section-3.2.3
Started a thread on hal-discuss. https://groups.google.com/forum/#!topic/hal-discuss/3hwoWts4GkQ
Add support for CURIES. See HAL specification: http://tools.ietf.org/pdf/draft-kelly-json-hal-06.pdf. Also see clarification here: https://groups.google.com/forum/#!topic/hal-discuss/1ZpslQ2GmG0