/// <summary> /// Decodes the request body into a string with the given encoding and returns it. /// </summary> /// <param name="encoding">The encoding to use. If null or omitted, Encoding.ASCII will be used.</param> /// <remarks> /// Will return incomplete data until FinishedRequestBody is true. /// </remarks> public string GetBody(Encoding encoding = null) { if (encoding == null) { encoding = Encoding.ASCII; } return(encoding.GetString(RequestBodyStream.ToArray())); }
/// <summary> /// Writes the request body to a byte array and returns it. /// </summary> /// <remarks> /// Will return incomplete data until FinishedRequestBody is true. /// </remarks> public byte[] GetBody() { return(RequestBodyStream.ToArray()); }
/// <summary> /// Writes the request body to a byte array and returns it. /// </summary> /// <remarks> /// Will return incomplete data until FinishedRequestBody is true. /// </remarks> public byte[] GetBody() => RequestBodyStream.ToArray();