Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the 'request' event instead of calling the first event handler di… #1107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pixcai
Copy link

@pixcai pixcai commented Jun 15, 2018

const http = require('http')
const connect = require('connect')

const app = connect()
const server = http.createServer()

server.addListener('request', (req, res) => console.log('hello'))
server.addListener('request', (req, res) => console.log('world'))

app.use('/hello', server)
app.use('/hello', (req, res) => res.end('nodejs'))

app.listen(3000)

If only use the first handler, "hello" can be output to the console, however "world" and res.end('nodejs') will not be invoked, while emit('request') can. Maybe we should do this?

@dougwilson
Copy link
Contributor

It's certainly possible to add. Can you add tests to our test suite for this, please?

@pixcai
Copy link
Author

pixcai commented Jun 15, 2018

Update and add test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants