Skip to content

Commit ed3e062

Browse files
claudiamurialdoclaudiamurialdo
andauthored
Refactor boolean header values to use bool.TrueString and bool.FalseString for consistency (#1218)
Co-authored-by: claudiamurialdo <c.murialdo@globant.com>
1 parent 92466a7 commit ed3e062

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

dotnet/src/dotnetframework/GxClasses/Helpers/HttpHelper.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static void CorsValuesToHeaders(OutgoingWebResponseContext httpResponse, string[
258258
if (!string.IsNullOrEmpty(origin))
259259
httpResponse.Headers[HeaderNames.AccessControlAllowOrigin] = origin;
260260
}
261-
httpResponse.Headers[HeaderNames.AccessControlAllowCredentials] = true.ToString();
261+
httpResponse.Headers[HeaderNames.AccessControlAllowCredentials] = bool.TrueString;
262262

263263
if (!string.IsNullOrEmpty(requestHeaders))
264264
httpResponse.Headers[HeaderNames.AccessControlAllowHeaders] = StringUtil.Sanitize(requestHeaders, StringUtil.HttpHeaderWhiteList);
@@ -276,7 +276,7 @@ static void CorsValuesToHeaders(HttpResponseMessageProperty httpResponse, string
276276
if (!string.IsNullOrEmpty(origin))
277277
httpResponse.Headers[HeaderNames.AccessControlAllowOrigin] = origin;
278278
}
279-
httpResponse.Headers[HeaderNames.AccessControlAllowCredentials] = true.ToString();
279+
httpResponse.Headers[HeaderNames.AccessControlAllowCredentials] = bool.TrueString;
280280

281281
if (!string.IsNullOrEmpty(requestHeaders))
282282
httpResponse.Headers[HeaderNames.AccessControlAllowHeaders] = StringUtil.Sanitize(requestHeaders, StringUtil.HttpHeaderWhiteList);
@@ -296,7 +296,7 @@ static void CorsValuesToHeaders(HttpResponse httpResponse, string[] origins, str
296296
if (!string.IsNullOrEmpty(origin))
297297
httpResponse.AppendHeader(HeaderNames.AccessControlAllowOrigin, origin);
298298
}
299-
httpResponse.AppendHeader(HeaderNames.AccessControlAllowCredentials, true.ToString());
299+
httpResponse.AppendHeader(HeaderNames.AccessControlAllowCredentials, bool.TrueString);
300300

301301
if (!string.IsNullOrEmpty(requestHeaders))
302302
httpResponse.AppendHeader(HeaderNames.AccessControlAllowHeaders, StringUtil.Sanitize(requestHeaders, StringUtil.HttpHeaderWhiteList));
@@ -880,18 +880,18 @@ public static void NewSessionCheck(this HttpContext context)
880880
string value = websession.Get<string>(NEWSESSION);
881881
if (string.IsNullOrEmpty(value))
882882
{
883-
websession.Set<string>(NEWSESSION, true.ToString());
883+
websession.Set<string>(NEWSESSION, bool.TrueString);
884884
}
885885
else
886886
{
887-
websession.Set<string>(NEWSESSION, false.ToString());
887+
websession.Set<string>(NEWSESSION, bool.FalseString);
888888
}
889889
}
890890
public static bool IsNewSession(this HttpContext context)
891891
{
892892
GxWebSession websession = new GxWebSession(new HttpSessionState(context.Session));
893893
string value=websession.Get<string>(NEWSESSION);
894-
return string.IsNullOrEmpty(value) || value == true.ToString();
894+
return string.IsNullOrEmpty(value) || value == bool.TrueString;
895895
}
896896
#else
897897
public static bool IsNewSession(this HttpContext context)

dotnet/src/dotnetframework/GxClasses/Model/gxproc.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ private void SetRecordCountSupportedHeader()
387387
if (!RecordCountSupported())
388388
{
389389
GXLogging.Debug(log, $"Adding '{RECORD_COUNT_SUPPORTED}' header");
390-
context.SetHeader(RECORD_COUNT_SUPPORTED, false.ToString());
390+
context.SetHeader(RECORD_COUNT_SUPPORTED, bool.FalseString);
391391
}
392392
}
393393

0 commit comments

Comments
 (0)