-
Notifications
You must be signed in to change notification settings - Fork 233
fix: consumeData(and consumeDataAsBytes) should consider structued mode JSON … #1164
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
Conversation
…content types also JSON Signed-off-by: Alan Kan <alan.kan@pepperstone.com>
Signed-off-by: Alan Kan <alan.kan@pepperstone.com>
Hi @embano1 , do you mind having another look? |
v2/event/content_type.go
Outdated
@@ -14,6 +14,20 @@ const ( | |||
ApplicationCloudEventsBatchJSON = "application/cloudevents-batch+json" | |||
) | |||
|
|||
type ContentType string |
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.
Hm, can we 1/ not export this and 2/ simplify this into just a simple function? See below.
v2/event/content_type.go
Outdated
type ContentType string | ||
|
||
// IsJSON returns true if the content type is a JSON type. | ||
func (c ContentType) IsJSON() bool { |
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.
Instead of introducing an exported type, how about:
func (c ContentType) IsJSON() bool { | |
func isJSON(contentType string) bool { ... } |
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.
The unit test cannot access it then :(
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 can ditch the unit test if preferred
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.
@embano1 updated as suggested, thanks 🙇
Signed-off-by: Alan Kan <alan.kan@pepperstone.com>
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.
Thx
…content types also JSON
#1161