forked from loafle/openapi-generator-original
update erlang server samples
This commit is contained in:
parent
513e242a3e
commit
70fb429c98
@ -6,8 +6,7 @@
|
|||||||
-type handler_response() ::{
|
-type handler_response() ::{
|
||||||
Status :: cowboy:http_status(),
|
Status :: cowboy:http_status(),
|
||||||
Headers :: cowboy:http_headers(),
|
Headers :: cowboy:http_headers(),
|
||||||
Body :: #{}
|
Body :: jsx:json_term()}.
|
||||||
}.
|
|
||||||
|
|
||||||
-export_type([handler_response/0]).
|
-export_type([handler_response/0]).
|
||||||
|
|
||||||
|
@ -475,5 +475,7 @@ validate_headers(_, Req) -> {true, Req}.
|
|||||||
|
|
||||||
prepare_body(204, Body) when map_size(Body) == 0; length(Body) == 0 ->
|
prepare_body(204, Body) when map_size(Body) == 0; length(Body) == 0 ->
|
||||||
<<>>;
|
<<>>;
|
||||||
|
prepare_body(304, Body) when map_size(Body) == 0; length(Body) == 0 ->
|
||||||
|
<<>>;
|
||||||
prepare_body(_Code, Body) ->
|
prepare_body(_Code, Body) ->
|
||||||
jsx:encode(Body).
|
jsx:encode(Body).
|
||||||
|
@ -64,4 +64,4 @@ get_default_opts(LogicHandler) ->
|
|||||||
#{env => get_default_dispatch(LogicHandler)}.
|
#{env => get_default_dispatch(LogicHandler)}.
|
||||||
|
|
||||||
store_key(Key, Value, Opts) ->
|
store_key(Key, Value, Opts) ->
|
||||||
lists:keystore(Key, 1, Opts, {Key, Value}).
|
maps:put(Key, Value, Opts).
|
||||||
|
@ -270,5 +270,7 @@ validate_headers(_, Req) -> {true, Req}.
|
|||||||
|
|
||||||
prepare_body(204, Body) when map_size(Body) == 0; length(Body) == 0 ->
|
prepare_body(204, Body) when map_size(Body) == 0; length(Body) == 0 ->
|
||||||
<<>>;
|
<<>>;
|
||||||
|
prepare_body(304, Body) when map_size(Body) == 0; length(Body) == 0 ->
|
||||||
|
<<>>;
|
||||||
prepare_body(_Code, Body) ->
|
prepare_body(_Code, Body) ->
|
||||||
jsx:encode(Body).
|
jsx:encode(Body).
|
||||||
|
@ -437,5 +437,7 @@ validate_headers(_, Req) -> {true, Req}.
|
|||||||
|
|
||||||
prepare_body(204, Body) when map_size(Body) == 0; length(Body) == 0 ->
|
prepare_body(204, Body) when map_size(Body) == 0; length(Body) == 0 ->
|
||||||
<<>>;
|
<<>>;
|
||||||
|
prepare_body(304, Body) when map_size(Body) == 0; length(Body) == 0 ->
|
||||||
|
<<>>;
|
||||||
prepare_body(_Code, Body) ->
|
prepare_body(_Code, Body) ->
|
||||||
jsx:encode(Body).
|
jsx:encode(Body).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user