ketting icon indicating copy to clipboard operation
ketting copied to clipboard

Expand templated link without following

Open chadkouse opened this issue 1 year ago • 1 comments

Hi - this may already exist but I can't find it.

Basically I have a (HAL) API that is including some _links -- and I want to just get the final expanded url of a particular rel after variable substitution without actually following the link. Following works but generates an HTTP request which I don't want/need.

I thought I could use the link method on the resource but it doesn't appear to accept linkvariables so it doesn't expand. Not to mention it's marked deprecated.

Can anyone point me in the right direction here? Love the library btw!

chadkouse avatar Jul 16 '24 20:07 chadkouse

Following a link generally does not cause a HTTP request. Initially you only get a reference to the target resource, but we're not assuming that you'll want to GET that resource.

So the easiest way to do this, is to follow the link after all, and then using resource.uri. Or do you have other reasons why you don't want to .follow() ?

evert avatar Jul 16 '24 20:07 evert

Closing due to no feedback

evert avatar Sep 22 '24 21:09 evert