Skip to content

Commit 81b33d3

Browse files
committed
test parse function
1 parent ded7a36 commit 81b33d3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

express-useragent/express-useragent-tests.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ app.get("/", function(req, res) {
2020

2121
res.end(userAgentString);
2222
});
23+
24+
app.get("/parse", function(req, res) {
25+
const source = req.headers['user-agent'],
26+
const ua = useragent.parse(source);
27+
res.writeHead(200, {'Content-Type': 'text/plain'});
28+
res.end(JSON.stringify(ua));
29+
});

0 commit comments

Comments
 (0)