2014-06-12 51 views
0

我有一个奇怪的,我希望有人可以帮忙,我有一个应用程序上传一个相当长的字符串作为后参数,我知道网络请求是正确的,因为它可以正常使用PHP。rails post参数截断

使用Rails 4但它似乎每次都只是砍掉在相同的点串,但我找不到,表示这是正常的行为,我很喜欢这样分配给它的任何文件:

mystring= params[:post_xml] 

,如果我做到以下几点:

mystring = request.body.read 

它工作正常!

任何想法?这里

EDIT为了清楚起见是我的C#代码请求其对端口3001那钢轨

HttpWebRequest的httpWReq =(HttpWebRequest的)WebRequest.Create( “http://mydomain.com:3001/api/new”)的测试端口;

 ASCIIEncoding encoding = new ASCIIEncoding(); 


     var textFromDoc = Globals.ThisAddIn.Application.ActiveDocument.Content.Text; 
     // string postData = "content=" + textFromDoc; 
     //byte[] data = encoding.GetBytes(postData); 

     byte[] data = Encoding.UTF8.GetBytes(textFromDoc); 

     httpWReq.Method = "POST"; 
     httpWReq.ContentType = "text/xml; encoding='utf-8'"; 
     //"application/x-www-form-urlencoded"; 
     httpWReq.ContentLength = data.Length; 

     using (Stream stream = httpWReq.GetRequestStream()) 
     { 
      stream.Write(data, 0, data.Length); 
     } 

     HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse(); 

     string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); 
     System.Windows.Forms.MessageBox.Show(responseString); 
    } 
    catch (System.Exception excep) 
    { 
     System.Windows.Forms.MessageBox.Show(excep.Message); 
    } 

回答