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

Make response of web api with handler return data optional #2

Open
wants to merge 1 commit into
base: feature/http-verbs
Choose a base branch
from

Conversation

tfKamran
Copy link
Member

@tfKamran tfKamran commented Sep 22, 2020

This change is Reviewable

@tfKamran tfKamran requested a review from myTerminal September 22, 2020 16:01
res: res
});

if (response) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand the motivation behind this check. How about ignore the response when not required rather than make this response optional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be times when it will not be a direct returned value that you need to respond to the client, for example when its an async process or when you want to return status codes other than 200.

So this check will see if anything is to be returned, else the called handler function will be responsible to respond.

It may have broken other parts of the code, we will probably need to find a better solution.

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

Successfully merging this pull request may close these issues.

2 participants