Пример #1
0
        public override FlurlCookie Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            reader.CheckStartObject();
            var originUrl    = reader.ReadString("OriginUrl");
            var dateReceived = reader.ReadDateTimeOffset("DateReceived");
            var name         = reader.ReadString("Name");
            var value        = reader.ReadString("Value");
            var expires      = reader.ReadNullableDateTimeOffset("Expires");
            var maxAge       = reader.ReadNullableInt32("MaxAge");
            var domain       = reader.ReadString("Domain");
            var path         = reader.ReadString("Path");
            var secure       = reader.ReadBoolean("Secure");
            var httpOnly     = reader.ReadBoolean("HttpOnly");
            var sameSite     = reader.ReadNullableEnum <SameSite>("SameSite");

            reader.ReadEndObject();

            return(new FlurlCookie(name, value, originUrl, dateReceived)
            {
                Expires = expires,
                MaxAge = maxAge,
                Domain = domain,
                Path = path,
                Secure = secure,
                HttpOnly = httpOnly,
                SameSite = sameSite
            });
        }