httprc:request 抛出异常退出:{noproc, {gen_server,call, [httpc_manager ...]}}
httprc:request throws exception exit: {noproc, {gen_server,call, [httpc_manager ...]}}
我想在我的 erlang 程序中调用 httprc:request
,但是我得到一个异常,它没有给我任何信息,出了什么问题。
这是我的代码:
print_helloworld() ->
Body = "userId=12345",
httpc:request(post,
{
"'http://192.168.2.100:8080/010/xmppcontrol", [],
"application/x-www-form-urlencoded",
Body
}, [], []).
这是我的例外:
1> hello_world:print_helloworld().
** exception exit: {noproc,
{gen_server,call,
[httpc_manager,
{request,
{request,undefined,<0.58.0>,0,'\'http',
{"192.168.2.100",8080},
"/010/xmppcontrol",[],post,
{http_request_h,undefined,"keep-alive",undefined,
undefined,undefined,undefined,undefined,undefined,
undefined,...},
{"application/x-www-form-urlencoded","userId=12345"},
{http_options,"HTTP/1.1",infinity,true,
{essl,[]},
undefined,false,infinity,...},
"'http://192.168.2.100:8080/010/xmppcontrol",[],none,
[],1510504662776,undefined,undefined,false}},
infinity]}}
in function gen_server:call/3 (gen_server.erl, line 214)
in call from httpc:handle_request/9 (httpc.erl, line 554)
你能告诉我 httpc:request
调用有什么问题吗,因为当我从 JS 调用 URL 时,它工作正常。
这是我来自 JavaScript 的代码:
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
asyncRequest = new XMLHttpRequest();
asyncRequest.addEventListener("readystatechange", stateChange, false);
asyncRequest.open('POST', 'http://192.168.2.100:8080/010/xmppcontrol?userId=' + userId , true);
asyncRequest.send(null);
提前致谢。
我想在我的 erlang 程序中调用 httprc:request
,但是我得到一个异常,它没有给我任何信息,出了什么问题。
这是我的代码:
print_helloworld() ->
Body = "userId=12345",
httpc:request(post,
{
"'http://192.168.2.100:8080/010/xmppcontrol", [],
"application/x-www-form-urlencoded",
Body
}, [], []).
这是我的例外:
1> hello_world:print_helloworld().
** exception exit: {noproc,
{gen_server,call,
[httpc_manager,
{request,
{request,undefined,<0.58.0>,0,'\'http',
{"192.168.2.100",8080},
"/010/xmppcontrol",[],post,
{http_request_h,undefined,"keep-alive",undefined,
undefined,undefined,undefined,undefined,undefined,
undefined,...},
{"application/x-www-form-urlencoded","userId=12345"},
{http_options,"HTTP/1.1",infinity,true,
{essl,[]},
undefined,false,infinity,...},
"'http://192.168.2.100:8080/010/xmppcontrol",[],none,
[],1510504662776,undefined,undefined,false}},
infinity]}}
in function gen_server:call/3 (gen_server.erl, line 214)
in call from httpc:handle_request/9 (httpc.erl, line 554)
你能告诉我 httpc:request
调用有什么问题吗,因为当我从 JS 调用 URL 时,它工作正常。
这是我来自 JavaScript 的代码:
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
asyncRequest = new XMLHttpRequest();
asyncRequest.addEventListener("readystatechange", stateChange, false);
asyncRequest.open('POST', 'http://192.168.2.100:8080/010/xmppcontrol?userId=' + userId , true);
asyncRequest.send(null);
提前致谢。