How to use the cookie-parser.apply function in cookie-parser

To help you get started, we’ve selected a few cookie-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thiagobustamante / typescript-rest / src / server / server-container.ts View on Github external
private buildCookieParserMiddleware() {
        const args = [];
        if (this.cookiesSecret) {
            args.push(this.cookiesSecret);
        }
        if (this.cookiesDecoder) {
            args.push({ decode: this.cookiesDecoder });
        }
        this.debugger.build('Creating cookie parser with options %j.', args);
        const middleware = cookieParser.apply(this, args);
        return middleware;
    }
}
github thiagobustamante / typescript-rest / src / typescript-rest.ts View on Github external
private buildServiceMiddleware(serviceMethod: ServiceMethod): Array {
		let result: Array = new Array();

		if (serviceMethod.mustParseCookies) {
			let args = [];
			if (InternalServer.cookiesSecret) {
				args.push(InternalServer.cookiesSecret);
			}
			if (InternalServer.cookiesDecoder){
				args.push({ decode: InternalServer.cookiesDecoder });
			}
			result.push(cookieParser.apply(this, args));
		}
		if (serviceMethod.mustParseBody) {
			result.push(bodyParser.json());
			//TODO adicionar parser de XML para o body
		}
		if (serviceMethod.mustParseForms) {
			result.push(bodyParser.urlencoded({ extended: true }));
			//TODO adicionar o multer para parsing arquivos
		}

		return result;
	}
github thiagobustamante / typescript-rest / release / lib / server-container.js View on Github external
InternalServer.prototype.buildServiceMiddleware = function (serviceMethod) {
        var result = new Array();
        if (serviceMethod.mustParseCookies) {
            var args = [];
            if (InternalServer.cookiesSecret) {
                args.push(InternalServer.cookiesSecret);
            }
            if (InternalServer.cookiesDecoder) {
                args.push({ decode: InternalServer.cookiesDecoder });
            }
            result.push(cookieParser.apply(this, args));
        }
        if (serviceMethod.mustParseBody) {
            result.push(bodyParser.json());
        }
        if (serviceMethod.mustParseForms || serviceMethod.acceptMultiTypedParam) {
            result.push(bodyParser.urlencoded({ extended: true }));
        }
        if (serviceMethod.files.length > 0) {
            var options_1 = new Array();
            serviceMethod.files.forEach(function (fileData) {
                if (fileData.singleFile) {
                    options_1.push({ "name": fileData.name, "maxCount": 1 });
                }
                else {
                    options_1.push({ "name": fileData.name });
                }
github thiagobustamante / typescript-rest / release / typescript-rest.js View on Github external
value: function buildServiceMiddleware(serviceMethod) {
            var result = new Array();
            if (serviceMethod.mustParseCookies) {
                var args = [];
                if (InternalServer.cookiesSecret) {
                    args.push(InternalServer.cookiesSecret);
                }
                if (InternalServer.cookiesDecoder) {
                    args.push({ decode: InternalServer.cookiesDecoder });
                }
                result.push(cookieParser.apply(this, args));
            }
            if (serviceMethod.mustParseBody) {
                result.push(bodyParser.json());
            }
            if (serviceMethod.mustParseForms) {
                result.push(bodyParser.urlencoded({ extended: true }));
            }
            return result;
        }
    }, {

cookie-parser

Parse HTTP request cookies

MIT
Latest version published 2 years ago

Package Health Score

74 / 100
Full package analysis