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

adonis-framework

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonis-framework - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

src/Cookies/index.js

4

package.json
{
"name": "adonis-framework",
"version": "1.0.6",
"version": "1.0.7",
"description": "Adonis framework a loosely coupled http server for adonis application, it does all the required hard work to setup a managable http server with depdendency injection in place.",

@@ -21,4 +21,6 @@ "main": "index.js",

"cookie": "^0.1.3",
"cookie-signature": "^1.0.6",
"dotenv": "^1.2.0",
"eventemitter2": "^0.4.14",
"keygrip": "git://github.com/crypto-utils/keygrip.git",
"lodash": "^3.10.0",

@@ -25,0 +27,0 @@ "mime": "^1.3.4",

@@ -14,3 +14,3 @@ 'use strict'

const helpers = require('./helpers')
const cookie = require('cookie')
const Cookies = require('../Cookies')
const contentType = require('content-type')

@@ -292,8 +292,5 @@

Request.prototype.cookies = function () {
if (!this.request.headers.cookie) {
return {}
}
return cookie.parse(this.request.headers.cookie)
return Cookies.parse(this.request)
}
module.exports = Request

@@ -10,4 +10,8 @@ 'use strict'

const NodeRes = require('node-res')
const Cookies = require('../Cookies')
NodeRes.prototype._send = NodeRes.prototype.send
function Response (View, Route) {
/**

@@ -30,3 +34,51 @@ * @function view

/**
* @function cookie
* @description attaches cookie to response
* @param {String} key
* @param {*} value
* @return {Object} reference to this for chaining
*/
NodeRes.prototype.cookie = function (key, value, options) {
if(!this._cookies){
this._cookies = {}
}
if(!key){
throw new Error('key is required to set cookie on request')
}
this._cookies[key] = {key:key,options:options,value:value}
return this;
}
/**
* @function clearCookie
* @description clears cookie by setting it expired
* @param {String} key
* @return {Object}
*/
NodeRes.prototype.clearCookie = function (key, options) {
options = options || {}
options.expires = new Date(1)
return this.cookie(key,'',options)
}
/**
* @function send
* @description overrides actual node-res send method to
* attach cookies while sending response
* @param {*} value
* @return {Object}
*/
NodeRes.prototype.send = function (value){
if(this._cookies){
Cookies.attachObject(this.response,this._cookies)
}
this._send(value)
return this
}
/**
* @function route

@@ -33,0 +85,0 @@ * @description redirect to a given route

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