From 6a58df737bcf6fe230431f022fbb490fec6dea90 Mon Sep 17 00:00:00 2001 From: Martin Lee Date: Thu, 5 Mar 2020 07:15:53 +0000 Subject: [PATCH] Add cookie --- BritishHorseRacingApi/ApiClient.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/BritishHorseRacingApi/ApiClient.cs b/BritishHorseRacingApi/ApiClient.cs index 2a1994f..b7af5b7 100644 --- a/BritishHorseRacingApi/ApiClient.cs +++ b/BritishHorseRacingApi/ApiClient.cs @@ -18,7 +18,11 @@ namespace BritishHorseRacingApi private const int _waitTimeAfterFail = 5; private const string _userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"; - public ApiClient(TimeSpan? delay = null) : base(delay) { } + public ApiClient(TimeSpan? delay = null, string cookie = null) : base(delay) + { + if(cookie != null) + _client.DefaultHeaders.Add("Cookie", cookie); + } public static class Endpoints {