![]() |
Indy HTTP client- Need help on Overwriting HTTP method - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Indy (https://www.atozed.com/forums/forum-8.html) +--- Forum: Indy General Discussion (https://www.atozed.com/forums/forum-9.html) +--- Thread: Indy HTTP client- Need help on Overwriting HTTP method (/thread-1565.html) |
Indy HTTP client- Need help on Overwriting HTTP method - happyzj - 03-04-2020 Hi, I used to built a Upnp control point using indy 10.5.9.4967. Wtih Upnp event subscribe, I overwrite the HTTP method with following code and it works: form1.myhttp.HTTPMethod := 'SUBSCRIBE'; ...... form1.myhttp.Get(URL); With Indy 10.6.1.518, I find idHTTP client doesn't have property "HTTPMethod" anymore and I tried following two property which doesn't work: myhttp.Request.Method := 'SUBSCRIBE'; myhttp.Request.MethodOverride := 'SUBSCRIBE'; Can someone help me out? thank you! RE: Indy HTTP client- Need help on Overwriting HTTP method - rlebeau - 03-04-2020 In order to specify a custom method, you will have to call TIdHTTP.DoRequest() directly. However, it is currently a protected method, so you will have to use an accessor class to reach it, eg: Code: type RE: Indy HTTP client- Need help on Overwriting HTTP method - happyzj - 03-04-2020 (03-04-2020, 07:56 PM)rlebeau Wrote:(03-04-2020, 04:39 AM)happyzj Wrote: With Indy 10.6.1.518, I find idHTTP client doesn't have property "HTTPMethod" anymore and I tried following two property which doesn't work: Thank you very much Rlebeau, in this case, would the custom header set in form1.myhttp - "myhttp.Request.CustomHeaders.Add(header)"would still take effect? thank you. RE: Indy HTTP client- Need help on Overwriting HTTP method - rlebeau - 03-05-2020 (03-04-2020, 08:00 PM)happyzj Wrote: would the custom header set in form1.myhttp - "myhttp.Request.CustomHeaders.Add(header)"would still take effect? Yes. All of the higher level methods (Get(), Post(), Put(), etc) call DoRequest() to do the actual work for preparing and sending the request, and reading the response. RE: Indy HTTP client- Need help on Overwriting HTTP method - happyzj - 03-05-2020 (03-05-2020, 07:21 PM)rlebeau Wrote:(03-04-2020, 08:00 PM)happyzj Wrote: would the custom header set in form1.myhttp - "myhttp.Request.CustomHeaders.Add(header)"would still take effect? Hi rlebeau, as always, thank you very much for your help, everthing is working now. |