diff --git a/src/sockjs_http.erl b/src/sockjs_http.erl index d9c06a2..ad7a3f0 100644 --- a/src/sockjs_http.erl +++ b/src/sockjs_http.erl @@ -16,13 +16,21 @@ path({cowboy, Req}) -> {Path, Req1} = cowboy_req:path(Req), method({cowboy, Req}) -> {Method, Req1} = cowboy_req:method(Req), {method_atom(Method), {cowboy, Req1}}. --spec method_atom(binary()) -> atom(). +-spec method_atom(binary() | atom()) -> atom(). method_atom(<<"GET">>) -> 'GET'; method_atom(<<"PUT">>) -> 'PUT'; method_atom(<<"POST">>) -> 'POST'; method_atom(<<"DELETE">>) -> 'DELETE'; method_atom(<<"OPTIONS">>) -> 'OPTIONS'; -method_atom(<<"PATCH">>) -> 'PATCH'. +method_atom(<<"PATCH">>) -> 'PATCH'; +method_atom(<<"HEAD">>) -> 'HEAD'; +method_atom('GET') -> 'GET'; +method_atom('PUT') -> 'PUT'; +method_atom('POST') -> 'POST'; +method_atom('DELETE') -> 'DELETE'; +method_atom('OPTIONS') -> 'OPTIONS'; +method_atom('PATCH') -> 'PATCH'; +method_atom('HEAD') -> 'HEAD'. -spec body(req()) -> {binary(), req()}. body({cowboy, Req}) -> {ok, Body, Req1} = cowboy_req:body(Req),