Sending Request from XData Server

Hi,

I'm developing an asset feature for my website and encountered an issue due to browser restrictions — I get CORS errors when trying to retrieve an asset’s size and type directly from the client side.

After some research, I found that sending a HEAD or GET request from the backend works fine.
To solve this, I created an endpoint called InspectUrl in my XData server. My goal is to send an asset URL to this endpoint, have the XData server request that URL, and then return the response headers (like Content-Length and Content-Type) to the client.

Could you please guide me on how to send an HTTP request from XData to an external URL and access its headers (size, type, etc.)?

Best regards.

You can use THttpClient object from Sparkle library. The process is described in this part of the documentation:

Thank you for your guidance — I successfully created it.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.