Code Monkey home page Code Monkey logo

Comments (6)

pksunkara avatar pksunkara commented on August 18, 2024

Go ahead and make a pull request. @indexzero, @mmalecki, can you check this?

from director.

indexzero avatar indexzero commented on August 18, 2024

@stolsma Hmm ... right. In the tightly integrated scenario (i.e. director + union), union is already stripping these characters before it's passed to the router. I suppose we can reparse here, but it should definitely be an option or something.

from director.

stolsma avatar stolsma commented on August 18, 2024

@indexzero Are you sure that union is stripping these characters in a integrated scenario? I'm asking this because my test implementation is using union+director and there url parameters doesn't work.... Example how I use it:

var union = require('union');
var router = require('director').http.Router().configure({async: true});

router.get(/foo/, function () {
  this.res.writeHead(200, { 'Content-Type': 'text/plain' })
  if (this.req.token) {
    this.res.end('hello ' + this.req.token.user + '\n');
  } else {
    this.res.end('hello world\n');
  }
});

var server = union.createServer({
  before: [
    function (req, res) {
      var found = router.dispatch(req, res);
      if (!found) {
        res.emit('next');
      }
    }
  ]
});

server.listen(9090);

Is there an easier way to implement my example??

from director.

indexzero avatar indexzero commented on August 18, 2024

@stolsma Again, you seem to be right. Union is parsing them, but not stripping them.

https://github.com/flatiron/union/blob/master/lib/request-stream.js#L31-43

Your example is correct.

from director.

stolsma avatar stolsma commented on August 18, 2024

@indexzero Thanks for the confirmation! :-)

In my opinion union must not strip anything from req.url because then we loose the original request url and thats also something I need... ;-)

from director.

indexzero avatar indexzero commented on August 18, 2024

yeah, we should probably put the parse somewhere though so we don't have to reparse it.

from director.

Related Issues (20)

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.