Comparing version 1.1.2 to 1.2.0
@@ -83,3 +83,5 @@ const http = require('http') | ||
let c = caseless(request.headers) | ||
c.set('accept', 'application/json') | ||
if (!c.get('accept')) { | ||
c.set('accept', 'application/json') | ||
} | ||
} | ||
@@ -86,0 +88,0 @@ return new Promise((resolve, reject) => { |
{ | ||
"name": "bent", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Functional HTTP client for Node.js w/ async/await.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -72,2 +72,14 @@ const http = require('http') | ||
paths['/media-type'] = (req, res) => { | ||
res.setHeader('content-type', 'application/json') | ||
res.end(JSON.stringify({ok: 200, accept: req.headers.accept})) | ||
} | ||
httpTest('json based media type', async t => { | ||
t.plan(1) | ||
let request = bent('json', { accept: 'application/vnd.something.com' }) | ||
let json = await request('http://localhost:3000/media-type') | ||
t.same({ok: 200, accept: 'application/vnd.something.com'}, json) | ||
}) | ||
test('basic PUT', async t => { | ||
@@ -74,0 +86,0 @@ t.plan(2) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15788
341