Skip to content

HttpResponseHeaders.GetValue

method · HttpResponseHeaders · cAlgo.API

DesktopCLICloud

Returns an existing header value.

Definition

public string GetValue(string name)
httpResponseHeaders.GetValue(name: str) -> str

Parameters

Name C# type Python type Description
name string str The Header name

Returns string — The Header value if the header is successfully found; otherwise, an empty string.

Examples

var response = Http.Get("https://api.example.com/quotes/EURUSD");
var contentType = response.Headers.GetValue("Content-Type");
if (contentType.Contains("json"))
    Print("JSON response: {0}", response.Body);
response = api.Http.Get("https://api.example.com/quotes/EURUSD")
contentType = response.Headers.GetValue("Content-Type")
if "json" in contentType:
    api.Print(f"JSON response: {response.Body}")