The following PR will fix an issue where context.fail() did not return custom status codes even though context.status() was called.
Description
I modified the context.succeed() and context.fail() methods to return a default status code of 200 and 500, respectively.
When the callback method (cb) is invoked, it will check which status code to return by checking if it has been defined by the handler (i.e. this.statusCode !== undefined). Otherwise, it will return the default status code mentioned above.
Motivation and Context
[x] I have raised an issue to propose this change (required)
Which issue(s) this PR fixes
Fixes #4
How Has This Been Tested?
I created a handler with the following snippet and got the expected status code and message.
The following PR will fix an issue where context.fail() did not return custom status codes even though context.status() was called.
Description
I modified the context.succeed() and context.fail() methods to return a default status code of 200 and 500, respectively.
When the callback method (cb) is invoked, it will check which status code to return by checking if it has been defined by the handler (i.e. this.statusCode !== undefined). Otherwise, it will return the default status code mentioned above.
Motivation and Context
Which issue(s) this PR fixes
Fixes #4
How Has This Been Tested?
I created a handler with the following snippet and got the expected status code and message.
Types of changes
Checklist:
git commit -s