public static Stream CreateBody(this FormDataSet formDataSet, String enctype, Encoding encoding)
        {
            if (enctype.Isi(MimeTypeNames.UrlencodedForm))
            {
                return(formDataSet.AsUrlEncoded(encoding));
            }
            else if (enctype.Isi(MimeTypeNames.MultipartForm))
            {
                return(formDataSet.AsMultipart(encoding));
            }
            else if (enctype.Isi(MimeTypeNames.Plain))
            {
                return(formDataSet.AsPlaintext(encoding));
            }
            else if (enctype.Isi(MimeTypeNames.ApplicationJson))
            {
                return(formDataSet.AsJson());
            }

            return(MemoryStream.Null);
        }
Exemple #2
0
        static Stream CreateBody(String enctype, Encoding encoding, FormDataSet formDataSet)
        {
            if (enctype.Equals(MimeTypes.UrlencodedForm, StringComparison.OrdinalIgnoreCase))
            {
                return(formDataSet.AsUrlEncoded(encoding));
            }
            else if (enctype.Equals(MimeTypes.MultipartForm, StringComparison.OrdinalIgnoreCase))
            {
                return(formDataSet.AsMultipart(encoding));
            }
            else if (enctype.Equals(MimeTypes.Plain, StringComparison.OrdinalIgnoreCase))
            {
                return(formDataSet.AsPlaintext(encoding));
            }
            else if (enctype.Equals(MimeTypes.ApplicationJson, StringComparison.OrdinalIgnoreCase))
            {
                return(formDataSet.AsJson());
            }

            return(MemoryStream.Null);
        }
        static Stream CreateBody(String enctype, Encoding encoding, FormDataSet formDataSet)
        {
            if (enctype.Isi(MimeTypeNames.UrlencodedForm))
            {
                return formDataSet.AsUrlEncoded(encoding);
            }
            else if (enctype.Isi(MimeTypeNames.MultipartForm))
            {
                return formDataSet.AsMultipart(encoding);
            }
            else if (enctype.Isi(MimeTypeNames.Plain))
            {
                return formDataSet.AsPlaintext(encoding);
            }
            else if (enctype.Isi(MimeTypeNames.ApplicationJson))
            {
                return formDataSet.AsJson();
            }

            return MemoryStream.Null;
        }
Exemple #4
0
        static Stream CreateBody(String enctype, Encoding encoding, FormDataSet formDataSet)
        {
            if (enctype.Equals(MimeTypes.UrlencodedForm, StringComparison.OrdinalIgnoreCase))
                return formDataSet.AsUrlEncoded(encoding);
            else if (enctype.Equals(MimeTypes.MultipartForm, StringComparison.OrdinalIgnoreCase))
                return formDataSet.AsMultipart(encoding);
            else if (enctype.Equals(MimeTypes.Plain, StringComparison.OrdinalIgnoreCase))
                return formDataSet.AsPlaintext(encoding);
            else if (enctype.Equals(MimeTypes.ApplicationJson, StringComparison.OrdinalIgnoreCase))
                return formDataSet.AsJson();

            return MemoryStream.Null;
        }