fix erlang client compilation error (#228)

This commit is contained in:
William Cheng 2018-04-26 13:44:05 +08:00 committed by GitHub
parent df26bcb40c
commit bcc7b788e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 9 deletions

2
.gitignore vendored
View File

@ -193,5 +193,7 @@ samples/client/petstore/elixir/mix.lock
samples/client/petstore/groovy/build
# erlang
samples/client/petstore/erlang-client/_build/
samples/client/petstore/erlang-client/rebar.lock
samples/server/petstore/erlang-server/_build/
samples/server/petstore/erlang-server/rebar.lock

View File

@ -74,8 +74,8 @@ update_params_with_auth(Cfg, Headers, QS) ->
AuthSettings = maps:get(auth, Cfg, #{}),
Auths = #{ {{#authMethods}}'{{name}}' =>
#{type => '{{type}}',
key => <<"{{keyParamName}}">>,
in => {{#isKeyInHeader}}header{{/isKeyInHeader}}{{#isKeyInQuery}}query{{/isKeyInQuery}}}{{#hasMore}}, {{/hasMore}}{{/authMethods}}},
key => <<"{{#isApiKey}}{{keyParamName}}{{/isApiKey}}{{^isApiKey}}Authorization{{/isApiKey}}">>,
in => {{^isApiKey}}header{{/isApiKey}}{{#isKeyInHeader}}header{{/isKeyInHeader}}{{#isKeyInQuery}}query{{/isKeyInQuery}}}{{#hasMore}}, {{/hasMore}}{{/authMethods}}},
maps:fold(fun(AuthName, #{type := _Type,
in := In,

View File

@ -86,7 +86,7 @@ place_order(Ctx, PetstoreOrder, Optional) ->
QS = [],
Headers = [],
Body1 = PetstoreOrder,
ContentTypeHeader = petstore_utils:select_header_content_type([<<"application/json">>]),
ContentTypeHeader = petstore_utils:select_header_content_type([]),
Opts = maps:get(hackney_opts, Optional, []),
petstore_utils:request(Ctx, Method, [?BASE_URL, Path], QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).

View File

@ -27,7 +27,7 @@ create_user(Ctx, PetstoreUser, Optional) ->
QS = [],
Headers = [],
Body1 = PetstoreUser,
ContentTypeHeader = petstore_utils:select_header_content_type([<<"application/json">>]),
ContentTypeHeader = petstore_utils:select_header_content_type([]),
Opts = maps:get(hackney_opts, Optional, []),
petstore_utils:request(Ctx, Method, [?BASE_URL, Path], QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
@ -48,7 +48,7 @@ create_users_with_array_input(Ctx, PetstoreUserArray, Optional) ->
QS = [],
Headers = [],
Body1 = PetstoreUserArray,
ContentTypeHeader = petstore_utils:select_header_content_type([<<"application/json">>]),
ContentTypeHeader = petstore_utils:select_header_content_type([]),
Opts = maps:get(hackney_opts, Optional, []),
petstore_utils:request(Ctx, Method, [?BASE_URL, Path], QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
@ -69,7 +69,7 @@ create_users_with_list_input(Ctx, PetstoreUserArray, Optional) ->
QS = [],
Headers = [],
Body1 = PetstoreUserArray,
ContentTypeHeader = petstore_utils:select_header_content_type([<<"application/json">>]),
ContentTypeHeader = petstore_utils:select_header_content_type([]),
Opts = maps:get(hackney_opts, Optional, []),
petstore_utils:request(Ctx, Method, [?BASE_URL, Path], QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).
@ -174,7 +174,7 @@ update_user(Ctx, Username, PetstoreUser, Optional) ->
QS = [],
Headers = [],
Body1 = PetstoreUser,
ContentTypeHeader = petstore_utils:select_header_content_type([<<"application/json">>]),
ContentTypeHeader = petstore_utils:select_header_content_type([]),
Opts = maps:get(hackney_opts, Optional, []),
petstore_utils:request(Ctx, Method, [?BASE_URL, Path], QS, ContentTypeHeader++Headers, Body1, Opts, Cfg).

View File

@ -77,8 +77,8 @@ update_params_with_auth(Cfg, Headers, QS) ->
key => <<"api_key">>,
in => header}, 'petstore_auth' =>
#{type => 'oauth2',
key => <<"">>,
in => }},
key => <<"Authorization">>,
in => header}},
maps:fold(fun(AuthName, #{type := _Type,
in := In,