Comparing version 2.1.0 to 2.1.1
@@ -34,5 +34,11 @@ 'use strict'; | ||
const acceptHeader = request.headers.accept; | ||
const isTextCsvAcceptHeader = acceptHeader.indexOf('text/csv') > -1; | ||
const isApplicationCsvAcceptHeader = acceptHeader.indexOf('application/csv') > -1; | ||
let isTextCsvAcceptHeader = false; | ||
let isApplicationCsvAcceptHeader = false; | ||
if (acceptHeader) { | ||
isTextCsvAcceptHeader = acceptHeader.indexOf('text/csv') > -1; | ||
isApplicationCsvAcceptHeader = acceptHeader.indexOf('application/csv') > -1; | ||
} | ||
if (internals.routeMap.has(request.route.path) && (isApplicationCsvAcceptHeader || isTextCsvAcceptHeader)) { | ||
@@ -39,0 +45,0 @@ const schema = internals.routeMap.get(request.route.path); |
@@ -0,0 +0,0 @@ The MIT License (MIT) |
{ | ||
"name": "hapi-csv", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Hapi plugin for converting a Joi response schema and dataset to csv", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -0,0 +0,0 @@ # Hapi-csv |
@@ -114,3 +114,20 @@ 'use strict'; | ||
server.stop(done); | ||
server.inject({ | ||
'method': 'GET', | ||
'url': '/user', | ||
'headers': { | ||
'Accept': '' | ||
} | ||
}, (getResponseNoAcceptHeaders) => { | ||
expectedResult = { | ||
first_name: 'firstName', | ||
last_name: 'lastName', | ||
age: 25 | ||
}; | ||
expect(getResponseNoAcceptHeaders.result).to.equal(expectedResult); | ||
server.stop(done); | ||
}); | ||
}); | ||
@@ -117,0 +134,0 @@ }); |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
109067
7
358
0