mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
Core - Add IResponse.SetHeaderByName/GetHeaderByName
This commit is contained in:
@@ -180,6 +180,21 @@ namespace CefSharp
|
||||
}
|
||||
}
|
||||
|
||||
virtual String^ GetHeaderByName(String^ name)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
return StringUtils::ToClr(_response->GetHeaderByName(StringUtils::ToNative(name)));
|
||||
}
|
||||
|
||||
virtual void SetHeaderByName(String^ name, String^ value, bool overwrite)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
ThrowIfReadOnly();
|
||||
|
||||
_response->SetHeaderByName(StringUtils::ToNative(name), StringUtils::ToNative(value), overwrite);
|
||||
}
|
||||
|
||||
void ThrowIfReadOnly()
|
||||
{
|
||||
if (_response->IsReadOnly())
|
||||
|
||||
@@ -47,5 +47,22 @@ namespace CefSharp
|
||||
/// Status Text
|
||||
/// </summary>
|
||||
string StatusText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the first header value for name or an empty string if not found.
|
||||
/// Will not return the Referer value if any. Use <see cref="Headers"/> instead if name might have multiple values.
|
||||
/// </summary>
|
||||
/// <param name="name">header name</param>
|
||||
/// <returns>Returns the first header value for name or an empty string if not found.</returns>
|
||||
string GetHeaderByName(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Set the header name to value. The Referer value cannot be set using this method.
|
||||
/// Use <see cref="SetReferrer(string, ReferrerPolicy)"/> instead.
|
||||
/// </summary>
|
||||
/// <param name="name">header name</param>
|
||||
/// <param name="value">new header value</param>
|
||||
/// <param name="overwrite">If overwrite is true any existing values will be replaced with the new value. If overwrite is false any existing values will not be overwritten</param>
|
||||
void SetHeaderByName(string name, string value, bool overwrite);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user