File tree Expand file tree Collapse file tree
lib/Domain/Requests/Facets Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
3+ using System . Globalization ;
34using System . Linq ;
45using System . Net . Http ;
56using System . Net . Http . Headers ;
@@ -164,14 +165,30 @@ public IEnumerable<HttpContent> ToHttpContent()
164165
165166 if ( value == null ) return null ;
166167
167- var contentItem = new StringContent ( value . ToString ( ) ) ;
168- contentItem . Headers . ContentDisposition =
169- new ContentDispositionHeaderValue ( item . Attrib . ContentDisposition ) { Name = item . Attrib . Name } ;
168+ var contentItem = new StringContent ( GetValueAsUsString ( value ) ) ;
169+
170+ contentItem . Headers . ContentDisposition = new ContentDispositionHeaderValue ( item . Attrib . ContentDisposition ) { Name = item . Attrib . Name } ;
170171
171172 return contentItem ;
172173 } ) . WhereNotNull ( ) ;
173174 }
174175
176+ static string GetValueAsUsString ( object value )
177+ {
178+ var cultureInfo = CultureInfo . GetCultureInfo ( "en-US" ) ;
179+
180+ return value switch
181+ {
182+ float f => f . ToString ( cultureInfo ) ,
183+ double d => d . ToString ( cultureInfo ) ,
184+ decimal c => c . ToString ( cultureInfo ) ,
185+ int i => i . ToString ( cultureInfo ) ,
186+ long l => l . ToString ( cultureInfo ) ,
187+ DateTime date => date . ToString ( cultureInfo ) ,
188+ _ => value ? . ToString ( )
189+ } ;
190+ }
191+
175192 #endregion
176193 }
177- }
194+ }
You can’t perform that action at this time.
0 commit comments