CurlSettings.

Fail Property

Summary

Gets or sets a value indicating whether HTTP errors should result in a non-zero exit code.
Assembly
Cake.Curl.dll
Namespace
Cake.Curl
Containing Type
CurlSettings

Syntax

public bool Fail { get; set; }

Remarks

When HTTP servers fail to fulfill a request, they will often return an HTML page with the error information to the client. In situations like these, curl's default behavior is to send the content of the error page to
stdout
and exit with a zero exit code, indicating success. While this may be fine at the command line, it's quite problematic in scripts where it can lead to false positives. Setting this property to , tells curl to treat HTTP errors (4xx and 5xx) as failed operations and to exit with status code
22
instead of
0
. Cake will then pick up the non-successful status code and turn it into a runtime exception. Note that, according to curl's documentation, this method is not completely fail-safe and there are occasions where non-successful response codes (especially those related to authentication, like
401
and
407
) will slip through.

Value

Type Description
bool