Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails rails post参数已截断_Ruby On Rails_Ruby_Post - Fatal编程技术网

Ruby on rails rails post参数已截断

Ruby on rails rails post参数已截断,ruby-on-rails,ruby,post,Ruby On Rails,Ruby,Post,我有一个奇怪的地方,我希望有人能帮我,我有一个应用程序,它上传了一个相当长的字符串作为post参数,我知道web请求是正确的,因为它可以与PHP一起工作 对于Rails 4,虽然它似乎每次都在同一点上切掉字符串,但我找不到任何文档表明这是正常行为,我这样分配它: mystring= params[:post_xml] 如果我这样做: mystring = request.body.read 很好用 有什么想法吗 为清晰起见,请编辑以下是我在端口3001上的C请求代码,因为这是rails的测试

我有一个奇怪的地方,我希望有人能帮我,我有一个应用程序,它上传了一个相当长的字符串作为post参数,我知道web请求是正确的,因为它可以与PHP一起工作

对于Rails 4,虽然它似乎每次都在同一点上切掉字符串,但我找不到任何文档表明这是正常行为,我这样分配它:

mystring= params[:post_xml]
如果我这样做:

mystring = request.body.read
很好用

有什么想法吗

为清晰起见,请编辑以下是我在端口3001上的C请求代码,因为这是rails的测试端口

HttpWebRequest httpWReq=HttpWebRequestWebRequest.Create

这与我的想法大不相同。这两种方法有不同的用途


查看以了解更多信息。

感谢您提供的链接,他们让我对详细信息有了更深入的了解,但仍然没有解释为什么params[:param]会被截断?除非我遗漏了什么?
        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);
    }