-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply ParameterDateFormat to date in header as well
- Loading branch information
Elzo Lubbers
committed
Feb 5, 2024
1 parent
116c636
commit fcd15c4
Showing
1 changed file
with
3 additions
and
1 deletion.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.HeaderParameter.liquid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{% if parameter.IsStringArray -%} | ||
request_.Headers.TryAddWithoutValidation("{{ parameter.Name }}", {{ parameter.VariableName }}); | ||
{% elsif parameter.IsDateTime -%} | ||
request_.Headers.TryAddWithoutValidation("{{ parameter.Name }}", ConvertToString({{ parameter.VariableName }}{% if parameter.IsNullable %}?{% endif %}.ToString("{{ ParameterDateTimeFormat }}"), System.Globalization.CultureInfo.InvariantCulture)); | ||
request_.Headers.TryAddWithoutValidation("{{ parameter.Name }}", ConvertToString({{ parameter.VariableName }}{% if parameter.IsNullable or parameter.IsSystemNullable %}?{% endif %}.ToString("{{ ParameterDateTimeFormat }}"), System.Globalization.CultureInfo.InvariantCulture)); | ||
{% elsif parameter.IsDate -%} | ||
request_.Headers.TryAddWithoutValidation("{{ parameter.Name }}", ConvertToString({{ parameter.VariableName }}{% if parameter.IsNullable or parameter.IsSystemNullable %}?{% endif %}.ToString("{{ ParameterDateFormat }}"), System.Globalization.CultureInfo.InvariantCulture)); | ||
{% else -%} | ||
request_.Headers.TryAddWithoutValidation("{{ parameter.Name }}", ConvertToString({{ parameter.VariableName }}, System.Globalization.CultureInfo.InvariantCulture)); | ||
{%- endif %} |