GithubHelp home page GithubHelp logo

hpp's People

Contributors

analog-nico avatar le0nik avatar maxrimue avatar waldyrious avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hpp's Issues

wrong comment?

// Select the first parameter value
reqPart[paramKey] = paramValue[paramValue.length-1];

As far as I understand, this selects the last parameter value.
Is the comment wrong or the assignement itself?

Breaks if you pass multiple keys of same name with one using sub-key

When I call this endpoint:
/search?name=Chris&name=Bob

It works as intended giving me the value of Bob

If I do the next query:
/search?name=Chris&name=Bob&name[test]

It breaks and outputs an object of all the values passed in and not the last value of Bob.

Is this a break or am I using the package wrong?

Thanks

import specific lodash libraries

I noticed that you import lodash as a whole instead of specific lodash libraries that you are using. I suggest you change that to avoid polluting the resulting packages.

Support for known array parameters

This module assumes that any query parameter is not supposed to be an array. However some applications might actually require to use an array parameter. This type of parameter is invalidated by this module while cleaning other potentially invalid parameters.

Example:

GET /?query=foo&query=bar&filters[]=123&filters[]=456

I would like a way to notify the plugin to clean only query or to exclude filters from the cleaning.

unable to get output as mentioned in document

firstly thank for this modules. am trying to incorporate this module in my project, below is the code

var express = require('express'), 
routes = require('./routes'),
user = require('./routes/user'),
http = require('http'),
metafetch = require('metafetch'),
expressValidator = require('express-validator'),
path = require('path');
var moment = require('moment');
var bodyParser = require('body-parser');
var hpp = require('hpp');
var errTo = require('errto');
var Err = require('custom-err');

var app = express();
var server = http.createServer(app);
//all environments
app.set('port', process.env.port || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
//app.use(express.bodyParser());

app.use(expressValidator()); // this line must be immediately after express.bodyParser()!

app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

app.use(bodyParser.urlencoded({extended: true}));
app.use(hpp()); // <- THIS IS THE NEW LINE

app.get('/hpp',function(req,res)
    {
        console.log("req.query.fname : ",req.query.fname);
        console.log("req.query.lname : ",req.query.lname);
        console.log("req.query : ",req.query);
        //console.log("req.body : ",req.body);
        //res.send(req.query);
});

http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});

output in console is
Express server listening on port 3000
req.query.fname : [ 'pitu', 'p3' ]
req.query.lname : undefined
req.query : { fname: [ 'pitu', 'p3' ], [proto]: {} }

i want output for fname to last value of array i.e "p3", am i doing something wrong

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.