digitalmars.D.learn - How to do HEAD request in std.net.curl
- data pulverizer (5/5) Apr 26 2020 Hi all,
- data pulverizer (16/21) Apr 26 2020 Never mind, I've got it, the answer was in a previous issue:
Hi all, I am using std.net.curl and would like to run a HEAD request to find out if a web page exists - I've looked at the documentation and have tried various things that haven't worked. Thanks
Apr 26 2020
On Sunday, 26 April 2020 at 22:03:33 UTC, data pulverizer wrote:Hi all, I am using std.net.curl and would like to run a HEAD request to find out if a web page exists - I've looked at the documentation and have tried various things that haven't worked. ThanksNever mind, I've got it, the answer was in a previous issue: https://forum.dlang.org/post/mailman.301.1412409956.9932.digitalmars-d-bugs puremagic.com ``` import std.net.curl; void main() { auto http = HTTP("dlang.org/non-existing-url"); http.onReceiveStatusLine = (HTTP.StatusLine s) { if (s.code != 200) throw new Exception("Request failed."); }; http.method = HTTP.Method.head; http.perform(); } ```
Apr 26 2020