Nancy (C#): How do I get my post data?

后端 未结 5 737
情书的邮戳
情书的邮戳 2021-02-07 01:29

I\'m using Corona SDK to post data to my C# server:

headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\"
headers[\"Accept-Language\"] = \"en-US\"

l         


        
5条回答
  •  耶瑟儿~
    2021-02-07 02:15

    For Nancy 2.0.0, Request.Body is a Stream rather than a RequestStream, so doesn't have an AsString method. However, this seems to work:

    using (var reqStream = RequestStream.FromStream(Request.Body))
    {
        var body = reqStream.AsString();
        // ... do stuff with body
    }
    

提交回复
热议问题