Last active
October 2, 2020 02:58
-
-
Save codegold79/8528d1e15fb6f58c3930dc636efbbde5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func parseCloudEvent(req []byte) (cloudEvent, error) { | |
var event cloudEvent | |
err := json.Unmarshal(req, &event) | |
if err != nil { | |
return cloudEvent{}, fmt.Errorf("unmarshalling json: %w", err) | |
} | |
if err := isValidEvent(event); err != nil { | |
return cloudEvent{}, err | |
} | |
return event, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment