Fix some SonarCloud issues (#955)

* Fixed some SonarCloud issues

* if (value.Contains('\n'))
This commit is contained in:
Stef Heyenrath
2023-06-13 19:31:04 +02:00
committed by GitHub
parent f6e35cbe2d
commit 5d0bf6f4e1
5 changed files with 176 additions and 167 deletions

View File

@@ -320,14 +320,14 @@ internal class OpenApiPathsMapper
var mappedHeaders = headers?.ToDictionary(
item => item.Key,
_ => GetExampleMatcherModel(null, _settings.HeaderPatternToUse).Pattern!
);
) ?? new Dictionary<string, object>();
if (!string.IsNullOrEmpty(responseContentType))
{
mappedHeaders.TryAdd(HeaderContentType, responseContentType!);
}
return mappedHeaders?.Keys.Any() == true ? mappedHeaders : null;
return mappedHeaders.Keys.Any() ? mappedHeaders : null;
}
private IList<ParamModel>? MapQueryParameters(IEnumerable<OpenApiParameter> queryParameters)