Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flair-doc

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flair-doc - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

10

index.js

@@ -301,4 +301,6 @@ var express = require('express')

if (types.indexOf(req.header('content-type')) > -1) {
if (contentTypes[req.header('content-type')]) {
var mime = req.header('content-type').split(';')[0];
if (types.indexOf(mime) > -1) {
if (contentTypes[mime]) {
if (!req.body) {

@@ -309,7 +311,7 @@ return next(new Error("Missing req.body for " + req.path));

req.body,
contentTypes[req.header('content-type')]
contentTypes[mime]
);
if (report.errors.length > 0) {
res.send(400, {
error: 'Body does not match schema for ' + req.header('content-type'),
error: 'Body does not match schema for ' + mime,
errors: report.errors

@@ -316,0 +318,0 @@ });

2

package.json
{
"name": "flair-doc",
"version": "0.0.5",
"version": "0.0.6",
"description": "Swagger-compliant REST API documentation generator",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -608,3 +608,29 @@ var should = require('should')

describe('#consumes', function() {
var app = express();
app.post(
'/blah',
flair.consumes("application/vnd.something+json"),
function(req, res) {
res.send("Yay!");
}
);
it('should handle request content-types with extra information', function(done) {
supertest(app)
.post('/blah')
.set('Content-Type', 'application/vnd.something+json; charset=utf-8')
.expect(200, function(err, res) {
if (err) {
done(err);
} else {
supertest(app)
.post('/blah')
.set('Content-Type', 'application/vnd.wrong+json; charset=utf-8')
.expect(400, done);
}
});
});
});
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc