Skip to content

Commit

Permalink
Support OPTIONS originating from CORS http request
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandar Filipov committed Jan 16, 2025
1 parent 35486bd commit 2dee6bc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/grpc/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ defmodule GRPC.Server do
)
end

# this handles preflight, relevant for COORS
def __call_rpc__(unquote(path), :options, stream) do
{:ok, stream}
end

if http_transcode and Map.has_key?(options, :http) do
%{value: http_rule} = GRPC.Service.rpc_options(rpc, :http)
{http_method, http_path, _matches} = Router.build_route(http_rule)
Expand Down

0 comments on commit 2dee6bc

Please sign in to comment.