feat: add user-agent endpoint

This commit is contained in:
David
2019-06-14 13:26:16 -07:00
parent 7f2f4661c7
commit 33e41571c2
2 changed files with 16 additions and 0 deletions

10
test.js
View File

@@ -15,6 +15,16 @@ tape('should respond hello', (t) => {
})
})
tape('should respond user-agent', (t) => {
const opts = { headers: { 'User-Agent': 'tape' } }
jsonist.get(`${urlBase}/user-agent`, opts, (err, body) => {
if (err) t.error(err)
t.equal(body.ua, 'tape')
t.end()
})
})
tape('cleanup', function (t) {
server.close()
t.end()