Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

koajs/querystring-strict

Repository files navigation

THIS REPOSITORY IS NOW DEPRECATED

This module had been merged into koa-qs, please use the first mode.

require('koa-qs')(app, 'first')

querystring-strict

NPM version build status appveyor build status Test coverage Gittip David deps iojs version node version npm download

This patches a koa app with this.query.foo return strict string. Disable multi values.

In 95% use cases, application only want string query params.

This patch can avoid some stupid TypeError and some security issues like MongoDB inject when the developers forget handling query params type check.

What's different

A normal request GET /foo?p=a,b&p=b,c.

  • before patch
console.log('%j', this.query.p);
["a,b", "b,c"]
  • after patch
console.log('%j', this.query.p);
"a,b"

Install

$ npm i koa-querystring-strict

Usage

var koa = require('koa');
var app = koa();
require('koa-querystring-strict')(app);

License

MIT

About

THIS REPOSITORY IS NOW DEPRECATED

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published