示例#1
0
 public void TestNull()
 {
     Assert.Throws(typeof(ArgumentNullException), delegate
     {
         _decoder.Decode(null,
                         "multipart/fodsa-data; boundary=---------------------------18506757825014",
                         Encoding.UTF8);
     });
 }
示例#2
0
        protected HttpForm DecodePost(Hashtable request)
        {
//            Hashtable form = (Hashtable)request["form"];
//            m_log.InfoFormat("[WATER WARS]: Got {0} items in form", form.Count);
//            foreach (object key in form)
//            {
//                DictionaryEntry tuple = (DictionaryEntry)key;
//                m_log.InfoFormat("[WATER WARS]: Form tuple {0}={1}", tuple.Key, tuple.Value);
//            }

            IFormDecoder formDecoder = new MultipartDecoder();
            HttpForm     form2
                = formDecoder.Decode(
                      new MemoryStream(Encoding.UTF8.GetBytes((string)request["body"])),
                      (string)request["content-type"],
                      Encoding.UTF8);

//            m_log.InfoFormat("[WATER WARS]: Got {0} items in form2", form2.Count);
//            foreach (object key in form2)
//            {
//                DictionaryEntry tuple = (DictionaryEntry)key;
//                m_log.InfoFormat("[WATER WARS]: Form2 tuple {0}={1}", tuple.Key, tuple.Value);
//            }

//            foreach (HttpInputItem item in form2)
//            {
//                m_log.InfoFormat("[WATER WARS]: Got form item {0}={1}", item.Name, item.Value);
//            }

            return(form2);
        }