Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _locks(headers) {
headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
tiny.get({
url,
headers
}, function done(err, response) {
if (err) {
console.log(err)
}
else {
callback(response.body, headers)
}
})
}
)
test('can read /', t=> {
t.plan(2)
tiny.get({
url: `http://localhost:${port}/`
},
function _got(err, data) {
if (err) {
t.fail(err)
console.log(err)
}
else {
t.ok(true, 'got /')
t.equals('hello world', data.body, 'is hello world')
console.log({data})
}
})
})
test('can read /api', t=> {
t.plan(2)
tiny.get({
url: `http://localhost:${port}/api`
},
function _got(err, data) {
if (err) {
t.fail(err)
console.log(err)
}
else {
t.ok(true, 'got /')
t.equals('world', data.body.hello, 'is hello world')
console.log(data)
}
})
})