我在使用Cowboy 2.0(最新的RC)的Erlang应用程序中获得了以下REST处理程序。我一直在反复阅读文档,我无法理解我的代码有什么问题。
my_handler
这些是日志。正如您所看到的,我已经开始了#34;内容协商"但是没有达到=INFO REPORT==== 31-Aug-2017::13:29:02 ===
Content negotiation
=CRASH REPORT==== 31-Aug-2017::13:29:02 ===
crasher:
initial call: cowboy_stream_h:proc_lib_hack/3
pid: <0.258.0>
registered_name: []
exception exit: {{case_clause,no_call},
[{cowboy_rest,set_resp_body,2,
[{file,
"/app/_build/default/lib/cowboy/src/cowboy_rest.erl"},
{line,1019}]},
{cowboy_rest,upgrade,4,
[{file,
"/app/_build/default/lib/cowboy/src/cowboy_rest.erl"},
{line,238}]},
{cowboy_stream_h,execute,3,
[{file,
"/app/_build/default/lib/cowboy/src/cowboy_stream_h.erl"},
{line,179}]},
{cowboy_stream_h,proc_lib_hack,3,
[{file,
"/app/_build/default/lib/cowboy/src/cowboy_stream_h.erl"},
{line,164}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,247}]}]}
in function cowboy_stream_h:proc_lib_hack/3 (/app/_build/default/lib/cowboy/src/cowboy_stream_h.erl, line 169)
ancestors: [<0.257.0>,<0.234.0>,<0.233.0>,ranch_sup,<0.222.0>]
message_queue_len: 0
messages: []
links: [<0.257.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 987
stack_size: 27
reductions: 596
neighbours:
=ERROR REPORT==== 31-Aug-2017::13:29:02 ===
Ranch listener my_http_listener, connection process <0.257.0>, stream 1 had its request process <0.258.0> exit with reason {case_clause,no_call} and stacktrace [{cowboy_rest,set_resp_body,2,[{file,"/app/_build/default/lib/cowboy/src/cowboy_rest.erl"},{line,1019}]},{cowboy_rest,upgrade,4,[{file,"/app/_build/default/lib/cowboy/src/cowboy_rest.erl"},{line,238}]},{cowboy_stream_h,execute,3,[{file,"/app/_build/default/lib/cowboy/src/cowboy_stream_h.erl"},{line,179}]},{cowboy_stream_h,proc_lib_hack,3,[{file,"/app/_build/default/lib/cowboy/src/cowboy_stream_h.erl"},{line,164}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]
回调。
content_types_provided/2
我不确定content_types_provided/2
回调与所选处理函数的关联是否存在任何问题。我已经编写了另一个非常相似的REST处理程序,它可以正常工作。
另外作为第二个问题,Accept: <type/sub-type>
是否有办法将每个请求定向到同一个处理程序,与请求中提供的 html { height: 100%; min-height: 100%; }
body { min-height: 100%; }
HTTP标头无关?