Returns the body in string format

This commit is contained in:
Rahul Rudragoudar 2018-11-10 12:34:05 +05:30
parent 4bf6b45f2f
commit 4acb527ec8

View File

@ -1393,6 +1393,14 @@ public class HTTPServer {
* @return the input stream containing the request body
*/
public InputStream getBody() { return body; }
/**
* Returns the body in a String format
*/
public String getJson(){
java.util.Scanner s = new java.util.Scanner(body).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
}
/**
* Returns the path component of the request URI, after