Skip to content

Commit 0ab4afd

Browse files
committed
update
1 parent a44f716 commit 0ab4afd

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

script.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const app = express();
33

44
app.use(express.json());
55

6-
76
function usernameExtractor(req, res, next) {
87
const username = req.get("X-Username");
98
req.username = username ? username : null;
@@ -25,13 +24,10 @@ app.post("/", usernameExtractor,(req, res) => {
2524
.send("Error: Array must contain only string elements.");
2625
}
2726

28-
let response = "";
2927

30-
if (username) {
31-
response += `You are authenticated as ${username}.`;
32-
} else {
33-
response += `You are not authenticated.`;
34-
}
28+
let response = username
29+
? `You are authenticated as ${username}.\n`
30+
: `You are not authenticated.\n`;
3531

3632
const count = subjects.length;
3733
const subjectArr = subjects.join(", ");

0 commit comments

Comments
 (0)