Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raw request Body Content

Tags:

nancy

I'm developing Nancy web service that will collect data from clients which will send HTTP requests like this

POST /iclock/cdata?SN=3163602360001&table=OPERLOG&OpStamp=426433018 HTTP/1.1
Host: 218.108.223.49:9001
User-Agent: iClock Proxy/1.09
Connection: close
Content-Length: 4883
Accept: */*

OPLOG 0\tab 0\tab 2012-09-07 11:36:39\tab 0\tab 0\tab 0\tab 0
OPLOG 3\tab 0\tab 2012-09-07 11:36:42\tab 55\tab 0\tab 0\tab 0

Problem is, that I can't find a way to collect those data in Nancy module. Is there any way to get raw request body content inside Nancy module?

like image 715
rmares Avatar asked Feb 17 '15 01:02

rmares


1 Answers

You can use .AsString() on the body tag to return the payload stream as the raw text passed from the client.

e.g

var body = Request.Body.AsString();

like image 191
Phill Avatar answered Sep 29 '22 17:09

Phill