Reputation: 572
I sent a restfull api request by http client, but i get below error:
{error,{failed_connect,[{to_address,{"https://example.com",443}},
{inet,[inet],{tls_alert,"record overflow"}}]}}
i found that SSL peer verification made this problem. how can i disable it?
my code:
test() ->
inets:start(),
ssl:start(),
RequestBody = "",
Request = {"https://example.com", [{"X-API-CODE",""}, {"Accept","application/json"}, {"access-token",""}], "application/json", RequestBody},
{ok, {_, _, ResponseBody}} = httpc:request(post, Request, [], []),
io:format("~st", [ResponseBody]).
Upvotes: 0
Views: 2388
Reputation: 466
Although disabling verification is not a good idea, but it's possible by using {ssl, [{verify, verify_none}]}
in the options.
Example:
httpc:request(get, {"https://revoked.badssl.com/", []}, [{ssl, [{verify, verify_none}]}], []).
Upvotes: 1