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

request.payload on onRequest is always null #3424

Closed
Zuckonit opened this Issue Jan 11, 2017 · 4 comments

Comments

Projects
None yet
6 participants
@Zuckonit
Copy link

commented Jan 11, 2017

version: hapi 14.20

question:

request.payload on onRequest is always null

code:

    server.ext('onRequest', function(request, reply) {
        console.log(requeset.payload); //always null
    })

test:

curl -XPOST http://localhost:5601/hello -d "name=Paul2"

@sirgallifrey

This comment has been minimized.

Copy link
Contributor

commented Jan 11, 2017

Payload has not yet been parsed at the time of onRequest. Have a look at this awesome cheatsheet

@Marsup Marsup added the non-issue label Jan 11, 2017

@Marsup Marsup self-assigned this Jan 11, 2017

@Marsup Marsup closed this Jan 11, 2017

@AdriVanHoudt

This comment has been minimized.

Copy link
Contributor

commented Jan 11, 2017

Here is version 2 ;)

by the great @mtharrison

@kafkahw

This comment has been minimized.

Copy link

commented Apr 9, 2019

Any idea how to access request's body on onRequest since payload is always null?

@hueniverse

This comment has been minimized.

Copy link
Member

commented Apr 9, 2019

@kafkahw you can't. You can only process the request stream on your own but that would create problems elsewhere. Just use the appropriate lifecycle spot instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.