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

@ -1394,6 +1394,14 @@ public class HTTPServer {
*/ */
public InputStream getBody() { return 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 * Returns the path component of the request URI, after
* URL decoding has been applied (using the UTF-8 charset). * URL decoding has been applied (using the UTF-8 charset).