How Do You Get wget to Work when curl Commands Are Successful?

Problem scenario
You have a URL that works with a curl command (with the -X POST option). You need to get wget to do a POST like curl. You are having trouble getting wget to work. wget returns 403 forbidden errors, but the destination address is the same. It seems as though the source server is different and potentially causing the problem (e.g, by virtue of its IP address). You do not think, but are not sure, that Jenkins has an authentication mechanism to differentiate the source IP address or other attributes about the source of the HTTP invocation to the URL.

What should you do?

Use the --post-data flag with two empty quotes like this:
wget --post-data '' http://URL

The wget command is significantly different from curl when it comes to doing detailed REST API troubleshooting. By specifying the --post-data flag and passing an empty value in quotes, you force the POST function as opposed to using a GET with wget.

Leave a comment

Your email address will not be published. Required fields are marked *