|
| 1 | +using RestSharp.Extensions; |
| 2 | +using System; |
| 3 | +using System.Collections.Generic; |
| 4 | +using System.Net; |
| 5 | +using System.Reflection; |
| 6 | +using System.Text; |
| 7 | + |
| 8 | +namespace RestSharp.Options { |
| 9 | + [GenerateImmutable] |
| 10 | + public class RestClientRedirectionOptions { |
| 11 | + static readonly Version Version = new AssemblyName(typeof(RestClientOptions).Assembly.FullName!).Version!; |
| 12 | + |
| 13 | + public bool FollowRedirects { get; set; } = true; |
| 14 | + public bool FollowRedirectsToInsecure { get; set; } = false; |
| 15 | + public bool ForwardHeaders { get; set; } = true; |
| 16 | + public bool ForwardAuthorization { get; set; } = false; |
| 17 | + public bool ForwardCookies { get; set; } = true; |
| 18 | + public bool ForwardBody { get; set; } = true; |
| 19 | + public bool ForwardQuery { get; set; } = true; |
| 20 | + public int MaxRedirects { get; set; } |
| 21 | + public bool ForwardFragment { get; set; } = true; |
| 22 | + public IReadOnlyList<HttpStatusCode> RedirectStatusCodes { get; set; } |
| 23 | + |
| 24 | + public RestClientRedirectionOptions() { |
| 25 | + RedirectStatusCodes = new List<HttpStatusCode>() { |
| 26 | + HttpStatusCode.MovedPermanently, |
| 27 | + HttpStatusCode.SeeOther, |
| 28 | + HttpStatusCode.TemporaryRedirect, |
| 29 | + HttpStatusCode.Redirect, |
| 30 | + #if NET |
| 31 | + HttpStatusCode.PermanentRedirect, |
| 32 | + #endif |
| 33 | + }.AsReadOnly(); |
| 34 | + } |
| 35 | + } |
| 36 | +} |
0 commit comments