// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Http; using Microsoft.AspNet.FeatureModel; using Microsoft.AspNet.HttpFeature; using Microsoft.AspNet.PipelineCore.Collections; using Microsoft.AspNet.PipelineCore.Infrastructure; namespace Microsoft.AspNet.PipelineCore { public class ResponseCookiesFeature : IResponseCookiesFeature { private readonly IFeatureCollection _features; private readonly FeatureReference _request = FeatureReference.Default; private IResponseCookies _cookiesCollection; public ResponseCookiesFeature(IFeatureCollection features) { _features = features; } public IResponseCookies Cookies { get { if (_cookiesCollection == null) { var headers = _request.Fetch(_features).Headers; _cookiesCollection = new ResponseCookies(new HeaderDictionary(headers)); } return _cookiesCollection; } } } }