public ProcessorMatch CanProcess(MediaRange requestedMediaRange, dynamic model, NancyContext context) { var match = new ProcessorMatch(); match.ModelResult = MatchResult.DontCare; match.RequestedContentTypeResult = MatchResult.ExactMatch; return(match); }
public ProcessorMatch CanProcess(MediaRange requestedMediaRange, dynamic model, NancyContext context) { var canProcess = new ProcessorMatch { ModelResult = MatchResult.NonExactMatch, RequestedContentTypeResult = requestedMediaRange.Matches(MediaType) ? MatchResult.ExactMatch : MatchResult.NoMatch }; return(canProcess); }
public ProcessorMatch CanProcess(MediaRange requestedMediaRange, dynamic model, NancyContext context) { var match = new ProcessorMatch(); var odataPackage = model as ODataResponse <PackageWithUrls>; if (odataPackage != null) { match.ModelResult = MatchResult.ExactMatch; } var odataPackageCollection = model as ODataResponse <IEnumerable <PackageWithUrls> >; if (odataPackageCollection != null) { match.ModelResult = MatchResult.ExactMatch; } match.RequestedContentTypeResult = MatchResult.ExactMatch;// requestedMediaRange.Matches(atomXmlContentType) ? MatchResult.ExactMatch : MatchResult.NonExactMatch; return(match); }
public ProcessorMatch CanProcess(MediaRange requestedMediaRange, dynamic model, NancyContext context) { var processorMatch = new ProcessorMatch { RequestedContentTypeResult = MatchResult.DontCare, ModelResult = MatchResult.NoMatch }; if (requestedMediaRange.Matches("application/json") || requestedMediaRange.Subtype?.ToString().EndsWith("json", StringComparison.InvariantCultureIgnoreCase) == true) { processorMatch.RequestedContentTypeResult = MatchResult.NonExactMatch; } if (model is Tavis.ProblemDocument) { processorMatch.ModelResult = MatchResult.ExactMatch; } return(processorMatch); }
/// <summary> /// Determines whether the given <paramref name="model"/> and be processed in <paramref name="requestedMediaRange"/> /// </summary> public ProcessorMatch CanProcess(MediaRange requestedMediaRange, [AllowNull] dynamic model, NancyContext context) { var match = new ProcessorMatch { ModelResult = model == null ? MatchResult.NoMatch : MatchResult.DontCare }; if (this.serializer != null) { if (new MediaRange(this.serialization.MediaType).Matches(requestedMediaRange)) { if (requestedMediaRange.IsWildcard == false) { match.RequestedContentTypeResult = MatchResult.ExactMatch; } else if (GetFallbackSerialization(context) == this.serialization) { match.RequestedContentTypeResult = MatchResult.NonExactMatch; } } } return(match); }
private static bool IsMatch(ProcessorMatch match) { return(match.RequestedContentTypeResult.In(MatchResult.ExactMatch) && match.ModelResult.In(MatchResult.ExactMatch, MatchResult.DontCare)); }