From f77c6d2cb404694a2598e905bad6af110e4fdb5f Mon Sep 17 00:00:00 2001 From: amaitland Date: Wed, 26 Jun 2019 16:30:02 +1000 Subject: [PATCH] IRequest - Add code example to Headers property Also updated the xml doc, there's new GetHeaderByName and SetHeaderByName methods that should be used where possible. Resolves #2671 --- CefSharp/IRequest.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/CefSharp/IRequest.cs b/CefSharp/IRequest.cs index 5e8ae0198e..4bc1511f3a 100644 --- a/CefSharp/IRequest.cs +++ b/CefSharp/IRequest.cs @@ -65,10 +65,22 @@ public interface IRequest : IDisposable ReferrerPolicy ReferrerPolicy { get; } /// - /// Header Collection + /// Header Collection - If dealing with headers that only contain a single value then + /// it's easier to use or . + /// You cannot modify the referrer using headers, use . /// NOTE: This collection is a copy of the underlying type, to make changes, take a reference to the collection, - /// make your changes, then reassign the collection. At some point this will be replaced with a proper wrapper. - /// + /// make your changes, then reassign the collection. + /// + /// + /// This example shows how to modify headers, make sure you reassign the collection + /// once it's been modified. + /// + /// var headers = request.Headers; + /// var userAgent = headers["User-Agent"]; + /// headers["User-Agent"] = userAgent + " CefSharp"; + /// request.Headers = headers; + /// + /// NameValueCollection Headers { get; set; } ///