-
Notifications
You must be signed in to change notification settings - Fork 73
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
http/endpoint: extract common pipe code #1113
base: master
Are you sure you want to change the base?
Conversation
defaultResultWriter and odataJsonWriter use identical code for piping results to response. This commit extracts the shared code into its own function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's been a while since this PR was pushed, but I just took a look, and the changes make sense to me. 💯
return true; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know undefined
is falsy, but I think it'd be nice if the function returned false
if it doesn't return true
.
@@ -192,20 +192,28 @@ const endpointBase = ({ preprocessor = noop, before = noop, resultWriter, errorW | |||
// ENDPOINT FORMAT SPECIALIZATIONS | |||
|
|||
//////////////////////////////////////// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line comment goes together with the line comment on the next line, so the two should be moved together. I think the two lines should come before defaultResultWriter()
/defaultErrorWriter()
/defaultEndpoint()
, similar to how there are line comments a bit above odataJsonWriter()
/odataXmlErrorWriter()
/odataJsonEndpoint()
/etc. (the // ODATA
comment and the line above it).
defaultResultWriter and odataJsonWriter use identical code for piping results to response. This commit extracts the shared code into its own function.
Follow-up to #1110