I don't fully understand how SWI Prolog handles http. I have the following code which mostly works apart from the get_header/1
. I need to be able to reader the header file of the http request to get a value. How do I do that? Do I use http_read_header/2
? If so how?
:- http_handler(root(handle), myhandle,[]).
myhandle(Request):-
get_header(H),
http_read_json_dict(Request,DictIn),
handle_dict(DictIn,DictOut),
reply_json(DictOut).
get_header(H):-
http_read_header(current_input, H),
something(H).