HttpResponse
class cAlgo.API
DesktopCLICloud
The class representing an HTTP response.
Definition
public sealed class HttpResponse
Namespace: cAlgo.API · Group: HTTP
Examples
var response = Http.Get("https://api.example.com/quotes/EURUSD");
if (response.IsSuccessful)
Print("Status: {0} | Content type: {1} | Body: {2}", response.StatusCode, response.Headers.GetValue("Content-Type"), response.Body);
else
Print("Request failed: {0}", response.Exception?.Message);
response = api.Http.Get("https://api.example.com/quotes/EURUSD")
if response.IsSuccessful:
api.Print(f"Status: {response.StatusCode} | Content type: {response.Headers.GetValue('Content-Type')} | Body: {response.Body}")
elif response.Exception is not None:
api.Print(f"Request failed: {response.Exception.Message}")
Properties
| Name | Description |
|---|---|
BodyDesktopCLICloudstring | Gets the body of the response. |
ExceptionDesktopCLICloudHttpException | Gets the exception thrown when sending HTTP request. |
HeadersDesktopCLICloudHttpResponseHeaders | Gets the headers contained in the response. |
IsSuccessfulDesktopCLICloudbool | Gets true if the response is successful, false otherwise. |
StatusCodeDesktopCLICloudint | Gets the response status code. |