Question
· Aug 8, 2019

Sending Get request

Hello! I'm sending get request. When send the request bellow 

Set httprequest=##class(%Net.HttpRequest).%New()
Set httprequest.Server=url
Do httprequest.Get("/"_par1_"/"_par2)

 Set statusCode = httprequest.HttpResponse.StatusCode

I get http status 200, but should get 410 status. Since the parameters passed are not valid. 

If I send request differently as below, I get http status 410, which is correct. 

Do httprequest.Get("/2019/0912")

What is the difference between these two requests Do httprequest.Get("/"_par1_"/"_par2) and Do httprequest.Get("/2019/0912")?

Discussion (8)1
Log in or sign up to continue

Remember about the second parameter in methods like Get and Post, which named test, which you can use for debugging purposes.

 If test is 1 then instead of connecting to a remote machine it will just output what it would have send to the web server to the current device, if test is 2 then it will output the response to the current device after the Get. This can be used to check that it will send what you are expecting.