From 55db3aee3933c2556374169e1d81a6e6bf5f5af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaudio=20Ku=C3=A7aj?= Date: Thu, 2 Jan 2025 15:52:42 +0100 Subject: [PATCH] refactor: Improvements for 'securityContext' null check when binding server --- lib/src/relic_server.dart | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/src/relic_server.dart b/lib/src/relic_server.dart index 75f193f..2008abf 100644 --- a/lib/src/relic_server.dart +++ b/lib/src/relic_server.dart @@ -60,21 +60,21 @@ class RelicServer { String? poweredByHeader, }) async { backlog ??= 0; - var server = switch (securityContext == null) { - true => await HttpServer.bind( - address.address, - port, - backlog: backlog, - shared: shared, - ), - false => await HttpServer.bindSecure( - address.address, - port, - securityContext!, - backlog: backlog, - shared: shared, - ), - }; + var server = securityContext == null + ? await HttpServer.bind( + address.address, + port, + backlog: backlog, + shared: shared, + ) + : await HttpServer.bindSecure( + address.address, + port, + securityContext, + backlog: backlog, + shared: shared, + ); + return RelicServer._( server, strictHeaders: strictHeaders,