3.13.1 Handling POST requests
Where the HTTP
GET operation is intended to get a
document, using a path and possibly some additional search
POST operation is intended to hand
potentially large amounts of data to the server for processing.
The Request parameter above contains the term
The data posted is left on the input stream that is available through
input(Stream) from the Request header.
This data can be read using http_read_data/3
from the HTTP client library. Here is a demo implementation simply
returning the parsed posted data as plain text (assuming pp/1
pretty-prints the data).
reply(Request) :- member(method(post), Request), !, http_read_data(Request, Data, ), format('Content-type: text/plain~n~n', ), pp(Data).
If the POST is initiated from a browser, content-type is generally