From 0ba1731928bef68cb74f47c67dceef0f8334e1b3 Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Thu, 17 Jul 2014 09:57:27 -0700 Subject: [PATCH] Add more feature constructors. --- src/Microsoft.AspNet.PipelineCore/FormFeature.cs | 6 ++++++ src/Microsoft.AspNet.PipelineCore/QueryFeature.cs | 6 ++++++ .../RequestCookiesFeature.cs | 8 +++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.PipelineCore/FormFeature.cs b/src/Microsoft.AspNet.PipelineCore/FormFeature.cs index e695b460a3..c2b90a6574 100644 --- a/src/Microsoft.AspNet.PipelineCore/FormFeature.cs +++ b/src/Microsoft.AspNet.PipelineCore/FormFeature.cs @@ -1,6 +1,7 @@ // 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 System.Collections.Generic; using System.IO; using System.Text; using System.Threading; @@ -20,6 +21,11 @@ namespace Microsoft.AspNet.PipelineCore private Stream _bodyStream; private IReadableStringCollection _form; + public FormFeature([NotNull] IDictionary form) + : this (new ReadableStringCollection(form)) + { + } + public FormFeature([NotNull] IReadableStringCollection form) { _form = form; diff --git a/src/Microsoft.AspNet.PipelineCore/QueryFeature.cs b/src/Microsoft.AspNet.PipelineCore/QueryFeature.cs index a2c7df5fe3..1cf25622df 100644 --- a/src/Microsoft.AspNet.PipelineCore/QueryFeature.cs +++ b/src/Microsoft.AspNet.PipelineCore/QueryFeature.cs @@ -1,6 +1,7 @@ // 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 System.Collections.Generic; using Microsoft.AspNet.FeatureModel; using Microsoft.AspNet.Http; using Microsoft.AspNet.HttpFeature; @@ -16,6 +17,11 @@ namespace Microsoft.AspNet.PipelineCore private string _queryString; private IReadableStringCollection _query; + public QueryFeature([NotNull] IDictionary query) + : this (new ReadableStringCollection(query)) + { + } + public QueryFeature([NotNull] IReadableStringCollection query) { _query = query; diff --git a/src/Microsoft.AspNet.PipelineCore/RequestCookiesFeature.cs b/src/Microsoft.AspNet.PipelineCore/RequestCookiesFeature.cs index 5507708ea6..952bfed0f6 100644 --- a/src/Microsoft.AspNet.PipelineCore/RequestCookiesFeature.cs +++ b/src/Microsoft.AspNet.PipelineCore/RequestCookiesFeature.cs @@ -2,9 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; +using Microsoft.AspNet.FeatureModel; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Infrastructure; -using Microsoft.AspNet.FeatureModel; using Microsoft.AspNet.HttpFeature; using Microsoft.AspNet.PipelineCore.Collections; using Microsoft.AspNet.PipelineCore.Infrastructure; @@ -19,6 +20,11 @@ namespace Microsoft.AspNet.PipelineCore private RequestCookiesCollection _cookiesCollection; private IReadableStringCollection _cookies; + public RequestCookiesFeature([NotNull] IDictionary cookies) + : this (new ReadableStringCollection(cookies)) + { + } + public RequestCookiesFeature([NotNull] IReadableStringCollection cookies) { _cookies = cookies;