1313 merge_openid_configuration /2 ,
1414 merge_oauth_provider /2 ,
1515 extract_ssl_options_as_list /1 ,
16- get_httpc_option_proxy_auth_if_any /1 ,
17- get_httpc_option_proxy_if_any /1 ,
18- get_httpc_option_ssl_options_if_any /1 ,
19- get_httpc_option_timeout_of_default /1 ,
16+ map_proxy_auth_to_httpc_option /1 ,
17+ map_proxy_to_httpc_option /1 ,
18+ map_ssl_options_to_httpc_option /1 ,
19+ map_timeout_to_httpc_option /1 ,
2020 format_ssl_options /1 , format_oauth_provider /1 , format_oauth_provider_id /1 ,
2121 extract_proxy_options_from_url /1
2222 ]).
@@ -47,8 +47,9 @@ refresh_access_token(OAuthProvider, Request) ->
4747 Header = [],
4848 Type = ? CONTENT_URLENCODED ,
4949 Body = build_refresh_token_request_body (Request ),
50- HTTPOptions = get_httpc_option_ssl_options_if_any (OAuthProvider ) ++
51- get_httpc_option_timeout_of_default (Request # refresh_token_request .timeout ),
50+ HTTPOptions =
51+ map_ssl_options_to_httpc_option (OAuthProvider # oauth_porvider .ssl_options ) ++
52+ map_timeout_to_httpc_option (Request # refresh_token_request .timeout ),
5253 Response = http_post (URL , Header , Type , Body , HTTPOptions ,
5354 OAuthProvider # oauth_provider .proxy_options ),
5455 parse_access_token_response (Response ).
@@ -57,21 +58,21 @@ http_post(URL, Header, Type, Body, HTTPOptions, ProxyOptions) ->
5758 case ProxyOptions of
5859 undefined -> httpc :request (post , {URL , Header , Type , Body }, HTTPOptions , []);
5960 _ ->
60- case httpc :set_options (get_httpc_option_proxy_if_any (ProxyOptions )) of
61+ case httpc :set_options (map_proxy_to_httpc_option (ProxyOptions )) of
6162 ok ->
6263 httpc :request (post , {URL , Header , Type , Body },
63- HTTPOptions ++ get_httpc_option_proxy_auth_if_any (ProxyOptions ), []);
64+ HTTPOptions ++ map_proxy_auth_to_httpc_option (ProxyOptions ), []);
6465 {error , _ } = Error -> Error
6566 end
6667 end .
6768http_get (URL , HTTPOptions , ProxyOptions ) ->
6869 case ProxyOptions of
6970 undefined -> httpc :request (get , {URL , []}, HTTPOptions , []);
7071 _ ->
71- case httpc :set_options (get_httpc_option_proxy_if_any (ProxyOptions )) of
72+ case httpc :set_options (map_proxy_to_httpc_option (ProxyOptions )) of
7273 ok ->
7374 httpc :request (get , {URL , []},
74- HTTPOptions ++ get_httpc_option_proxy_auth_if_any (ProxyOptions ), []);
75+ HTTPOptions ++ map_proxy_auth_to_httpc_option (ProxyOptions ), []);
7576 {error , _ } = Error -> Error
7677 end
7778 end .
@@ -589,19 +590,19 @@ append_extra_parameters(Request, QueryList) ->
589590 Params -> Params ++ QueryList
590591 end .
591592
592- get_httpc_option_ssl_options_if_any ( OAuthProvider ) ->
593- case OAuthProvider # oauth_provider . ssl_options of
593+ map_ssl_options_to_httpc_option ( SslOptions ) ->
594+ case SslOptions of
594595 undefined -> [];
595596 Options -> [{ssl , Options }]
596597 end .
597598
598- get_httpc_option_timeout_of_default (Timeout ) ->
599+ map_timeout_to_httpc_option (Timeout ) ->
599600 case Timeout of
600601 undefined -> [{timeout , ? DEFAULT_HTTP_TIMEOUT }];
601602 Timeout -> [{timeout , Timeout }]
602603 end .
603604
604- get_httpc_option_proxy_if_any (ProxyOptions ) ->
605+ map_proxy_to_httpc_option (ProxyOptions ) ->
605606 case ProxyOptions of
606607 undefined ->
607608 [];
@@ -618,7 +619,7 @@ get_httpc_option_proxy_if_any(ProxyOptions) ->
618619 end
619620 end .
620621
621- get_httpc_option_proxy_auth_if_any (ProxyOptions ) ->
622+ map_proxy_auth_to_httpc_option (ProxyOptions ) ->
622623 case ProxyOptions of
623624 undefined ->
624625 [];
0 commit comments