Syncronous HTTP.get() call in Template Helper

So I have a template helper which I call embedMedia which purpose is to take a SoundCloud link, run it through their oembed API, take the returned value and spit out the html response (basically a html formatted iframe) to be embedded in a template.

Right now I am doing this through HTTP.get(). I have a collection of these SoundCloud links and basically just want this HTTP.get() to run for each of the links to return the iframe.

My question is, how can I structure this given that the method calls (or HTTP.get()'s) are asynchronous? Would I just setup a Session variable pr request and then return that pr link?

The recommended answer from this SO question is a good way of doing this.

1 Like

Thanks for the point in the right direction @robfallows