public void silly_with_works() { var state = new CookieState("key").With("a", "1").With("b", "2"); state["a"].ShouldBe("1"); state["b"].ShouldBe("2"); }
public static Cookie ToCookie(string headerValue) { if (headerValue.IsEmpty()) { return(null); } var cookie = new Cookie(); var segments = headerValue.TrimEnd().TrimEnd(';').Split(';').Select(x => new Segment(x.Trim())); segments.Each(segment => { string canonicalKey = segment.Key.ToLowerInvariant(); if (_setters.Has(canonicalKey)) { _setters[canonicalKey](cookie, segment.Value); } else { var state = CookieState.For(segment); cookie.Add(state); } }); return(cookie); }
public Cookie(string name, string value) { var state = new CookieState(name, value); _states.Add(state); }
public Cookie Add(CookieState state) { _states.Add(state); return this; }
public Cookie Add(CookieState state) { _states.Add(state); return(this); }