Get rid of checks when creating constructs. Check should handle this.

This commit is contained in:
2024-10-19 14:12:51 +02:00
parent 960889f9e7
commit 57db4178d0
21 changed files with 143 additions and 345 deletions

View File

@@ -15,13 +15,9 @@ type InlineOtherContent struct {
// newInlineOtherContent creates a new InlineOtherContent. It returns a
// *InlineOtherContent and an error.
func newInlineOtherContent(mediaType string, content any) (*InlineOtherContent, error) {
if !isValidMediaType(mediaType) {
return nil, fmt.Errorf("error creating new inline other content: media type %v invalid", mediaType)
}
func newInlineOtherContent(mediaType string, content any) *InlineOtherContent {
mediaType, _, _ = mime.ParseMediaType(mediaType)
return &InlineOtherContent{Type: mediaType, AnyElement: content}, nil
return &InlineOtherContent{Type: mediaType, AnyElement: content}
}
// isContent checks whether the InlineOtherContent is a Content. It returns a