From 425f7c8bb657559c9c6ce77549afd344dad10b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 13 Jan 2023 09:45:02 +0100 Subject: [PATCH] mix format --- lib/plug/cowboy/translator.ex | 9 +++++---- test/plug/cowboy/conn_test.exs | 16 ++++++++-------- test/plug/cowboy/websocket_handler_test.exs | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/plug/cowboy/translator.ex b/lib/plug/cowboy/translator.ex index 321d99b..28a4923 100644 --- a/lib/plug/cowboy/translator.ex +++ b/lib/plug/cowboy/translator.ex @@ -39,10 +39,11 @@ defmodule Plug.Cowboy.Translator do | Exception.format(:exit, reason, []) ] - metadata = [ - crash_reason: reason, - domain: [:cowboy] - ] ++ maybe_conn_metadata(conn) + metadata = + [ + crash_reason: reason, + domain: [:cowboy] + ] ++ maybe_conn_metadata(conn) {:ok, message, metadata} else diff --git a/test/plug/cowboy/conn_test.exs b/test/plug/cowboy/conn_test.exs index a5af995..161d605 100644 --- a/test/plug/cowboy/conn_test.exs +++ b/test/plug/cowboy/conn_test.exs @@ -372,7 +372,7 @@ defmodule Plug.Cowboy.ConnTest do end test "upgrades the connection when the connection is a valid websocket" do - {:ok, socket} = :gen_tcp.connect('localhost', 8003, active: false, mode: :binary) + {:ok, socket} = :gen_tcp.connect(~c"localhost", 8003, active: false, mode: :binary) :gen_tcp.send(socket, """ GET /upgrade_websocket HTTP/1.1\r @@ -610,7 +610,7 @@ defmodule Plug.Cowboy.ConnTest do opts = [ pool: :https, - ssl_options: [cacertfile: @https_options[:certfile], server_name_indication: 'localhost'] + ssl_options: [cacertfile: @https_options[:certfile], server_name_indication: ~c"localhost"] ] assert {:ok, 200, _headers, client} = @@ -622,7 +622,7 @@ defmodule Plug.Cowboy.ConnTest do @http2_opts [ cacertfile: @https_options[:certfile], - server_name_indication: 'localhost', + server_name_indication: ~c"localhost", port: 8004 ] @@ -646,21 +646,21 @@ defmodule Plug.Cowboy.ConnTest do end test "http2 response" do - {:ok, pid} = Kadabra.open('localhost', :https, @http2_opts) + {:ok, pid} = Kadabra.open(~c"localhost", :https, @http2_opts) Kadabra.get(pid, "/http2") assert_receive({:end_stream, %Kadabra.Stream.Response{body: "HTTP/2", status: 200}}, 1_000) end test "http2 early hints" do - {:ok, pid} = Kadabra.open('localhost', :https, @http2_opts) + {:ok, pid} = Kadabra.open(~c"localhost", :https, @http2_opts) Kadabra.get(pid, "/http2?earlyhints=true") assert_receive({:end_stream, %Kadabra.Stream.Response{headers: headers}}) assert {"link", "; rel=preload; as=style"} in headers end test "http2 server push" do - {:ok, pid} = Kadabra.open('localhost', :https, @http2_opts) + {:ok, pid} = Kadabra.open(~c"localhost", :https, @http2_opts) Kadabra.get(pid, "/http2") assert_receive({:push_promise, %Kadabra.Stream.Response{headers: headers}}) assert {"accept", "text/css"} in headers @@ -668,7 +668,7 @@ defmodule Plug.Cowboy.ConnTest do end test "http2 server push without automatic mime type" do - {:ok, pid} = Kadabra.open('localhost', :https, @http2_opts) + {:ok, pid} = Kadabra.open(~c"localhost", :https, @http2_opts) Kadabra.get(pid, "/http2?noinfer=true") assert_receive({:push_promise, %Kadabra.Stream.Response{headers: headers}}) assert {"accept", "text/plain"} in headers @@ -691,7 +691,7 @@ defmodule Plug.Cowboy.ConnTest do opts = [ pool: :client_ssl_pool, - ssl_options: [server_name_indication: 'localhost'] ++ @client_ssl_opts + ssl_options: [server_name_indication: ~c"localhost"] ++ @client_ssl_opts ] assert {:ok, 200, _headers, client} = diff --git a/test/plug/cowboy/websocket_handler_test.exs b/test/plug/cowboy/websocket_handler_test.exs index fd87eb5..3485f38 100644 --- a/test/plug/cowboy/websocket_handler_test.exs +++ b/test/plug/cowboy/websocket_handler_test.exs @@ -70,7 +70,7 @@ defmodule WebSocketHandlerTest do # Simple WebSocket client def tcp_client(context) do - {:ok, socket} = :gen_tcp.connect('localhost', context[:port], active: false, mode: :binary) + {:ok, socket} = :gen_tcp.connect(~c"localhost", context[:port], active: false, mode: :binary) socket end