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

http/endpoint: extract common pipe code #1113

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alxndrsn
Copy link
Contributor

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

alxndrsn added 2 commits March 21, 2024 09:43
defaultResultWriter and odataJsonWriter use identical code for piping results to
response.  This commit extracts the shared code into its own function.
Copy link
Member

@matthew-white matthew-white left a 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. 💯

Comment on lines +207 to +209
return true;
}
};
Copy link
Member

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

////////////////////////////////////////
Copy link
Member

@matthew-white matthew-white Oct 3, 2024

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).

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