Skip to content

Commit

Permalink
refactor: Improvements for 'securityContext' null check when binding …
Browse files Browse the repository at this point in the history
…server
  • Loading branch information
klkucaj committed Jan 2, 2025
1 parent 2f58e56 commit 55db3ae
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions lib/src/relic_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 55db3ae

Please sign in to comment.