First the basics of cURL:
cURL Manual https://curl.haxx.se/docs/manpage.html
curl https://my-site-under-test.com -v -o /dev/null
This will use the HTTPS protocol and print out verbose info. It will discard the HTML body to "/dev/null". You can remove -o and the "/dev/null" if you need to see the HTML or other returned content, i.e. you need to confirm the web page is returned.
cURL with Sauce Connect Proxy
curl --proxy localhost:3788 https://my-site-under-test.com -v -o /dev/null
- Start a Sauce Connect tunnel or find the logs of an existing tunnel.
- Obtain the port used by SC from the logs. Looks like: Started scproxy on port 52178
curl -I --proxy localhost:52178 www.google.com
cURL with a generic proxy (not sauce connect)
curl --proxy username:password@proxy.com:port https://some-website.com -v
If you can curl a destination, say a site under test, and get a response, then Sauce Connect should be able to get there too. So before delving into Sauce Connect verify all the basic network connections exist via curl.
- curl the site under test
- If it fails check for a proxy. curl with aforementioned proxy, see "Curl with a generic proxy"
- Start sc and curl with sauce connect. verify the curl from step 1 and step 3 match.
Non-cURL Fetch Method
The Google Chrome browser, and maybe more, support the fetch library out of the box. You can paste a fetch request into the browser's Developer Tools Console to reproduce HTTP problems. For example:
fetch('https://my-companies-site.net/cart/', {
method: 'GET',
headers: {
'accept': '*/*',
'userToke': '1234',
'customHeader2': 'somethingImportant1234',
}
})
.then(res => res.json())
.then(console.log)