Skip to content

Commit a7e5c17

Browse files
committed
improve readability
1 parent 81397fe commit a7e5c17

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/Server.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,17 @@ class Server {
100100
if (etag === null && lastModified === null)
101101
break conditional;
102102

103-
if ((
104-
req.headers.has("if-match")
105-
&& !this.getETags(req.headers.get("if-match")!)
106-
.filter(t => !t.startsWith("W/"))
107-
.includes(etag!)
108-
)
109-
|| (
110-
req.headers.has("if-unmodified-since")
103+
if (req.headers.has("if-match") && !this.getETags(req.headers.get("if-match")!)
104+
.filter(t => !t.startsWith("W/"))
105+
.includes(etag!))
106+
return this.errors._get(ServerErrorRegistry.ErrorCodes.PRECONDITION_FAILED, req)._send(res, this, req);
107+
108+
if (req.headers.has("if-unmodified-since")
111109
&& (
112110
lastModified === null
113111
|| lastModified.getTime() > new Date(req.headers.get("if-unmodified-since")!).getTime()
114-
)
115-
)) return this.errors._get(ServerErrorRegistry.ErrorCodes.PRECONDITION_FAILED, req)._send(res, this, req);
112+
))
113+
return this.errors._get(ServerErrorRegistry.ErrorCodes.PRECONDITION_FAILED, req)._send(res, this, req);
116114

117115
if ((
118116
etag !== null

0 commit comments

Comments
 (0)