dialogflow / dialogflow-fulfillment-nodejs

Dialogflow agent fulfillment library supporting v1&v2, 8 platforms, and text, card, image, suggestion, custom responses
Apache License 2.0
597 stars 281 forks source link

Invalid use of res.status() ? #256

Closed jamesfernandes closed 3 years ago

jamesfernandes commented 5 years ago

I may be missing something here, but seems to me passing a string to res.status() is not supported in expressjs, only a status code. Perhaps a typo where res.send() was intended?

Current:

this.response_
    .status(RESPONSE_CODE_BAD_REQUEST)
    .status('No handler for requested intent');

Intended(?):

this.response_
    .status(RESPONSE_CODE_BAD_REQUEST)
    .send('No handler for requested intent');

I would further note that the dependency on response_.status() and response_.json() in this library does not make it compatible with standard nodejs, which does not include these helper functions.

I'd be willing to submit a PR switching to using the nodejs "native" properties (statusCode, statusMessage) if it would be helpful.