We are having an issue with IRestRequest. When trying to consume a JSON request, if there is a & in a Json String, IRestRequest is breaking the request Form input more then 1 variable which is causing issues.
How can we resolve this?
We are having an issue with IRestRequest. When trying to consume a JSON request, if there is a & in a Json String, IRestRequest is breaking the request Form input more then 1 variable which is causing issues.
How can we resolve this?
Also if you are accepting JSON, why are you reading request.Form? If you are passing in JSON as the request, you need to read the body raw then deserialize
How do we access the raw body?
How do we access the raw body?
It the Reques's input stream
specifically IRestRequest.Request.InputStream
public static string GetDocumentContents(System.Web.HttpRequestBase request) { // reset the stream position as telligent has already read the input stream if (request.InputStream.CanRead && request.InputStream.CanSeek) { request.InputStream.Position = 0; } else { throw new Exception("Unable to reset input stream"); } string documentContents; using (Stream receiveStream = request.InputStream) { using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8)) { documentContents = readStream.ReadToEnd(); } } return documentContents; }