Hi,
I've noticed that omitting to read the data in the body of a POST request causes the HTTP connection to be reset. For instance, the following code works fine:
:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_client)).
:- http_handler(root(hello_world), say_hi, []).
server(Port) :-
http_server(http_dispatch, [port(Port)]).
say_hi(Request) :-
open("TestFile.mdxml", write, Stream),
http_read_data(Request, _, [to(stream(Stream))]),
close(Stream),
format('Content-type: text/plain~n~n'),
format('Hello World!~n').
However, when commenting out the call to the http_read_data/3 predicate, the "Hello world!" message is no longer returned, and the connection is reset.
How can I avoid this if I am not interested in the contents of the POST request body (i.e. I don't need to read them), and would just like to return a message without reading the contents?
Thanks,
Vlad