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

Fetch Mime Type From EnumDescriptor #72

Merged
merged 2 commits into from
Jan 28, 2024
Merged

Fetch Mime Type From EnumDescriptor #72

merged 2 commits into from
Jan 28, 2024

Conversation

stevenhartley
Copy link

In lieu of a switch statement and static defining the mime type, pull the mime type from the proto generated code

#71

In lieu of a switch statement and static defining the mime type, pull
the mime type from the proto generated code

#71
@@ -467,24 +469,14 @@ static CloudEvent fromMessageParts(UUri source, UAttributes attributes, UPayload
static UPayloadFormat getUPayloadFormatFromContentType(String contentType){
if(contentType == null)
Copy link
Contributor

Choose a reason for hiding this comment

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

want to try using a Stream with a filter.
Nothing wrong with for loops and if statements - just saying.
This method is going to be called a lot - nice if it was efficient.
I take it the unit tests did not change and you ran them all. :)

Copy link
Author

Choose a reason for hiding this comment

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

Done please re-review

Copy link
Contributor

@tamarafischer tamarafischer left a comment

Choose a reason for hiding this comment

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

Approving, please check in your tests that you do not throw exceptions or barf in any way, you have a strong contract that is someone gives you something you don't know, you return the default. Otherwise we would need to use an Optional or a Result.
You made a change that does not break the client contract, your tests should make sure of that.
Changing code to look nicer or be optimized is great refactoring, as long as you have tests to cover you.

@stevenhartley stevenhartley merged commit 33cb83e into main Jan 28, 2024
2 checks passed
@stevenhartley stevenhartley deleted the mime_check branch January 28, 2024 18:25
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.

3 participants