Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand templated link without following #488

Open
chadkouse opened this issue Jul 16, 2024 · 1 comment
Open

Expand templated link without following #488

chadkouse opened this issue Jul 16, 2024 · 1 comment

Comments

@chadkouse
Copy link

chadkouse commented Jul 16, 2024

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!

@evert
Copy link
Collaborator

evert commented Jul 16, 2024

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() ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants