Error calling the service using reqwest

Hi I am getting error connecting to the service.

reqwest::Error { kind: Request, url: Url { scheme: "http", host: Some(Domain("sit.test.com")), port: Some(8008), path: "/xml_request.xml", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("dns error", Custom { kind: Other, error: "failed to lookup address information: nodename nor servname provided, or not known" })) }

This is on mac. If I use the curl request from mac it works. After looking up on internet I added sit.test.com in my /private/etc/hosts file restarted the mac. But didn't work.
Here is the code for review Ubuntu Pastebin
Thanks for the help.

Have you tried running dscacheutil -q host -a name sit.test.com from your macOS command line?