addOfferedMediaType method
Parses a String-based mediaType
and adds it to the set of
offeredMediaTypes.
Throws an HttpException if the mediaType
cannot be parsed and an
ArgumentError if the mediaType
should not be supported.
Implementation
void addOfferedMediaType(String mediaType) {
final parsedMediaType = ContentType.parse(mediaType).toString();
if (!isSupportedMediaType(parsedMediaType)) {
throw ArgumentError.value(
mediaType,
"addOfferedMediaType",
"Not a supported media type",
);
}
_offeredMediaTypes.add(parsedMediaType);
}