Socket
Socket
Sign inDemoInstall

baiji

Package Overview
Dependencies
188
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.8.21 to 0.8.22

5

lib/Context.js

@@ -113,2 +113,7 @@ 'use strict';

// Alias `done()`
respond() {
return this.done.apply(this, arguments);
}
// General send response method, should be overwritten

@@ -115,0 +120,0 @@ done() {

22

lib/contexts/express.js

@@ -98,4 +98,11 @@ 'use strict';

let contentType = ctx.get('Content-Type');
// Allow user specified content-type
let contentType = ctx.response.get('Content-Type');
let hasAccept = ctx.get('Accept');
// If client do not send Accept header, then use user defined content-type
if (!hasAccept && contentType) {
accepts = contentType.toLowerCase();
}
if (dataExists) {

@@ -139,8 +146,12 @@ switch (accepts) {

default:
// not acceptable
ctx.sendStatus(406);
if (accepts) {
ctx.send(data);
} else {
// not acceptable
ctx.sendStatus(406);
}
break;
}
} else {
if (!ctx.get('Content-Type')) {
if (!contentType) {
ctx.header('Content-Type', 'application/json');

@@ -194,3 +205,2 @@ }

.method('format')
.method('get')
.method('json')

@@ -220,2 +230,3 @@ .method('jsonp')

.method('is')
.method('get')
.method('range')

@@ -236,3 +247,2 @@

.getter('hostname')
.getter('header')
.getter('headers')

@@ -239,0 +249,0 @@ .getter('ip')

{
"name": "baiji",
"version": "0.8.21",
"version": "0.8.22",
"description": "Baiji is an easy to use and opinionated micro-framework for writing scalable and REST-like web APIs. Its main goals are parameter validation, entities, hooks, scalability and allowing rapid development and deployment of such APIs.",

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc