How to get full URL from %Net.Request object after request
I have a %Net.Request object and I want to get a full URL of the request sent (preferably after all redirects, but even full initial one would be good). For example, I have the following method:
ClassMethod GetBingRequest() As %Net.HttpRequest
{
#dim request As %Net.HttpRequest
set request = ##class(%Net.HttpRequest).%New()
set request.Server = "api.datamarket.azure.com"
set request.Https = $$$YES
set request.SSLConfiguration = "Bing"
set request.Username = ..GetBingAPIKey()
set request.Password = ..GetBingAPIKey()
set request.Location = "Data.ashx/Bing/SearchWeb/v1/Composite"
do request.SetParam("$top", 1)
do request.SetParam("$format", "JSON")
quit request
}
And I invoke it with the method:
ClassMethod Get(Query As %String) {
set request = ..GetBingRequest()
do request.SetParam("Query", "'" _ Query _ "'")
do request.Get()
}
How can I get the full URL of where the request went?
P.S. This is a working code for Bing Search API – Web Results Only .