/// <summary> /// Checks for an illegal media type that cannot be caught during content negotiation/resolution /// since it would match an unsupported media type. /// </summary> /// <param name="mediaType">The parsed media type to check.</param> /// <returns>true if the media type is illegal (and we should fail); otherwise false.</returns> internal bool IsIllegalMediaType(MediaType mediaType) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(mediaType != null, "mediaType != null"); // We fail for JSON-Light for all versions < V3. // NOTE: once we support custom formats and custom content negotiation, we will have to move this logic into // the format itself (i.e., also register Json Light for V1 and V2 but make it fail). if (this.version < ODataVersion.V3 && HttpUtils.CompareMediaTypeNames(mediaType.SubTypeName, MimeConstants.MimeJsonSubType) && HttpUtils.CompareMediaTypeNames(mediaType.TypeName, MimeConstants.MimeApplicationType) && (mediaType.MediaTypeHasParameterWithValue(MimeConstants.MimeODataParameterName, MimeConstants.MimeODataParameterValueMinimalMetadata) || mediaType.MediaTypeHasParameterWithValue(MimeConstants.MimeODataParameterName, MimeConstants.MimeODataParameterValueFullMetadata) || mediaType.MediaTypeHasParameterWithValue(MimeConstants.MimeODataParameterName, MimeConstants.MimeODataParameterValueNoMetadata))) { return(true); } return(false); }
/// <summary> /// Determines whether the media type has a 'streaming' parameter with the value 'true'. /// </summary> /// <param name="mediaType">The media type to check.</param> /// <returns> /// <c>true</c> if the media type has a 'streaming' parameter with the value 'true'; otherwise, <c>false</c>. /// </returns> internal static bool HasStreamingSetToTrue(this MediaType mediaType) { DebugUtils.CheckNoExternalCallers(); return(mediaType.MediaTypeHasParameterWithValue(MimeConstants.MimeStreamingParameterName, MimeConstants.MimeStreamingParameterValueTrue)); }