Beispiel #1
0
        internal HttpRequest(CreateOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            Id = Guid.NewGuid();

            string httpMethod = Constants.HttpMethodRegex.Replace(options.HttpMethod ?? string.Empty, string.Empty).Trim().ToUpperInvariant();

            if (string.IsNullOrWhiteSpace(httpMethod))
            {
                throw new ArgumentNullException(nameof(httpMethod));
            }

            Url             = options.Url ?? throw new ArgumentNullException(nameof(options.Url));
            HttpMethod      = httpMethod;
            UserAgent       = options.UserAgent;
            RemoteAddress   = options.RemoteAddress;
            HttpReferer     = options.HttpReferer;
            SessionId       = options.SessionId;
            IsNewSession    = options.IsNewSession;
            IsAuthenticated = options.IsAuthenticated;
            MachineName     = options.MachineName;
            Properties      = options.Properties ?? new RequestProperties(new RequestProperties.CreateOptions());
            StartDateTime   = options.StartDateTime;
        }
Beispiel #2
0
 internal void SetProperties(RequestProperties properties)
 {
     Properties = properties ?? throw new ArgumentNullException(nameof(properties));
 }