toString

open fun toString(jo: JSONObject): String

Convert a JSONObject into an HTTP header. A request header must contain

{
   Method: "POST" (for example),
   "Request-URI": "/" (for example),
   "HTTP-Version": "HTTP/1.1" (for example)
}
A response header must contain
{
   "HTTP-Version": "HTTP/1.1" (for example),
   "Status-Code": "200" (for example),
   "Reason-Phrase": "OK" (for example)
}
Any other members of the JSONObject will be output as HTTP fields. The result will end with two CRLF pairs.

Return

An HTTP header string.

Parameters

jo

A JSONObject

Throws

if the object does not contain enough information.