FF-162: Fix crash on partial request (#189)

* FF-162: Fix crash on partial request

* Remove warning
This commit is contained in:
Sergey Yelin 2020-03-04 13:12:35 +03:00 committed by GitHub
parent 49fb9c0e4e
commit 53d84a7cf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,7 +63,11 @@ mk_operation_id_getter(#{env := Env}) ->
get_operation_id(Req, Env)
end.
get_operation_id(Req, Env) ->
%% Ensure that request has host and path required for
%% cowboy_router:execute/2.
%% NOTE: Be careful when upgrade cowboy in this project
%% because cowboy_router:execute/2 call can change.
get_operation_id(Req=#{host := _Host, path := _Path}, Env) ->
case cowboy_router:execute(Req, Env) of
{ok, _, #{handler_opts := {_Operations, _LogicHandler, _SwaggerHandlerOpts} = HandlerOpts}} ->
case swag_server_wallet_utils:get_operation_id(Req, HandlerOpts) of
@ -74,4 +78,6 @@ get_operation_id(Req, Env) ->
end;
_ ->
#{}
end.
end;
get_operation_id(_Req, _Env) ->
#{}.