Get rid of checks when creating constructs. Check should handle this.
This commit is contained in:
@@ -14,23 +14,10 @@ type OutOfLineContent struct {
|
||||
}
|
||||
|
||||
// newOutOfLineContent creates a new OutOfLineContent. It returns a
|
||||
// *OutOfLineContent and an error.
|
||||
func newOutOfLineContent(mediaType string, content any) (*OutOfLineContent, error) {
|
||||
if !isValidMediaType(mediaType) {
|
||||
return nil, fmt.Errorf("error creating new out of line content: media type %v invalid", mediaType)
|
||||
}
|
||||
// *OutOfLineContent.
|
||||
func newOutOfLineContent(mediaType, src string) *OutOfLineContent {
|
||||
mediaType, _, _ = mime.ParseMediaType(mediaType)
|
||||
|
||||
iri, ok := content.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("content type %T incompatible with out of line content", content)
|
||||
}
|
||||
|
||||
if !isValidIRI(iri) {
|
||||
return nil, fmt.Errorf("content %v not a valid uri", iri)
|
||||
}
|
||||
|
||||
return &OutOfLineContent{Type: mediaType, SRC: iri}, nil
|
||||
return &OutOfLineContent{Type: mediaType, SRC: src}
|
||||
}
|
||||
|
||||
// isContent checks whether the OutOfLineContent is a Content. It returns a
|
||||
|
Reference in New Issue
Block a user