【发布时间】:2017-06-10 18:09:16
【问题描述】:
我不完全理解 SWI Prolog 如何处理 http。我有以下代码,除了get_header/1 之外,它主要工作。我需要能够读取 http 请求的头文件以获取值。我怎么做?我使用http_read_header/2 吗?如果有怎么办?
:- 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).
【问题讨论】:
标签: http prolog swi-prolog