Socket
Socket
Sign inDemoInstall

koa-redirect-loop

Package Overview
Dependencies
5
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.4 to 2.0.5

20

index.js

@@ -24,8 +24,20 @@ const Url = require('url-parse');

async middleware(ctx, next) {
if (!ctx.session) throw new Error('Sessions required');
if (typeof ctx.saveSession !== 'function')
throw new Error(
'Please use koa-generic-session v2.0.3+ which exposes a `ctx.saveSession()` method'
if (!ctx.session) {
config.logger.error(
new Error(
'ctx.session missing, sessions required for koa-redirect-loop'
)
);
return next();
}
if (typeof ctx.saveSession !== 'function') {
config.logger.error(
new Error(
'Please use koa-generic-session v2.0.3+ which exposes a `ctx.saveSession()` method'
)
);
return next();
}
const { config } = this;

@@ -32,0 +44,0 @@ const { redirect } = ctx;

2

package.json
{
"name": "koa-redirect-loop",
"description": "Prevent redirect loops with sessions since HTTP referrer header is unreliable and ensures sessions are saved upon redirect",
"version": "2.0.4",
"version": "2.0.5",
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",

@@ -6,0 +6,0 @@ "ava": {

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