Hi!
I have a problem with host name resolving - requestHTTP can't resolve any name, but works with IP addresses only. For example, I can dig or NSLookup api.sendgrid.com:
crimaniak@crimaniak-X550LB:~$ nslookup api.sendgrid.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: api.sendgrid.com
Address: 159.122.224.201
Name: api.sendgrid.com
Address: 159.122.224.200
but next code gives me exception:
enum mailEndpoint = "https://api.sendgrid.com/v3/mail/send";
...
return requestHTTP(mailEndpoint, (scope HTTPClientRequest request){
request.method = HTTPMethod.POST;
request.headers["Authorization"] = "Bearer "~apiKey;
...
});
From both static unittest block and real test page requested from browser. How to debug this issue?
Thanks.
object.Exception@../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/core/drivers/libevent2.d(270): Failed to lookup host 'api.sendgrid.com': nodename nor servname provided, or not known
----------------
/usr/include/dmd/phobos/std/exception.d:405 pure @safe void std.exception.bailOut!(Exception).bailOut(immutable(char)[], ulong, const(char[])) [0x6c26f7]
/usr/include/dmd/phobos/std/exception.d:363 pure @safe bool std.exception.enforce!(Exception, bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) [0x6c267a]
../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/core/drivers/libevent2.d:270 vibe.core.net.NetworkAddress vibe.core.drivers.libevent2.Libevent2Driver.resolveHost(immutable(char)[], ushort, bool) [0x733fab]
../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/core/net.d:45 vibe.core.net.NetworkAddress vibe.core.net.resolveHost(immutable(char)[], ushort, bool) [0x7522e7]
../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/core/net.d:40 vibe.core.net.NetworkAddress vibe.core.net.resolveHost(immutable(char)[], std.socket.AddressFamily, bool) [0x75223e]
../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/http/client.d:594 bool vibe.http.client.HTTPClient.doRequest(scope void delegate(vibe.http.client.HTTPClientRequest), bool*, bool, std.datetime.SysTime) [0x6f9829]
../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/http/client.d:515 bool vibe.http.client.HTTPClient.doRequestWithRetry(scope void delegate(vibe.http.client.HTTPClientRequest), bool, out bool, out std.datetime.SysTime) [0x6f9463]
../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/http/client.d:486 vibe.http.client.HTTPClientResponse vibe.http.client.HTTPClient.request(scope void delegate(vibe.http.client.HTTPClientRequest)) [0x6f927b]
../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/http/client.d:95 vibe.http.client.HTTPClientResponse vibe.http.client.requestHTTP(vibe.inet.url.URL, scope void delegate(scope vibe.http.client.HTTPClientRequest), const(vibe.http.client.HTTPClientSettings)) [0x6f7eba]
../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/http/client.d:71 vibe.http.client.HTTPClientResponse vibe.http.client.requestHTTP(immutable(char)[], scope void delegate(scope vibe.http.client.HTTPClientRequest), const(vibe.http.client.HTTPClientSettings)) [0x6f7b82]
src/vendor/sendgrid/api/v3.d:25 vibe.http.client.HTTPClientResponse v3.SendGrid.sendMail(immutable(char)[], immutable(char)[], immutable(char)[]) [0x6f5d0c]
src/vendor/sendgrid/api/v3.d:43 void v3.__unittestL38_2() [0x6f5f18]
...