maciekmm / messenger-platform-go-sdk

:envelope: A GO SDK for Facebook's messenger-platform: https://developers.facebook.com/docs/messenger-platform
MIT License
110 stars 27 forks source link

add http request to message event #24

Closed connyay closed 7 years ago

connyay commented 8 years ago

Allows access of raw incoming request in hooks

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.02%) to 92.892% when pulling 3241c94aafb627dc8f02507d0df820a977847b40 on connyay:event-req into d4827eb98b660821d2b332757f3aad98feeaf825 on maciekmm:master.

maciekmm commented 8 years ago

I was trying to come up with any use-case that would utilize this feature, but I couldn't figure out any.

Is there any specific situation where having this field helps?

case commented 8 years ago

Our use-case here is the desire to access the query parameters in the requests the Messenger bot is making to our API.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.02%) to 92.995% when pulling eda30bf3235466b78df989f4dd5b255db51986f9 on nbio:event-req into 8c94baa4bd465fb029a82f2f1b46f2b2662ad066 on maciekmm:master.

cee-dub commented 7 years ago

I've updated and rebased this code to the current master. Now that context is used fairly extensively with *http.Request I think there's even more reason to give clients access to the HTTP request that created the Event. Separately, it's also very difficult to do certain types of logging or extract useful fields from within our HTTP handlers without having access to the request.

Please reconsider accepting this PR.

maciekmm commented 7 years ago

@cee-dub Thank you for your contribution. I have merged the PR, albeit I can't seem to find a use-case where accessing request would be of any use. I don't know what's under 'useful fields' and I think that these fields should be exposed directly by the SDK, but after all it doesn't hurt performance so I've decided to merge this PR, if you've made it then i presume there's a valid case for that ;) Thanks. 👍

cee-dub commented 7 years ago

Cheers!