Skip to content

Commit

Permalink
Use TryGetValue
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Schmidmeister committed Mar 6, 2020
1 parent fbe967a commit 1712aa4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Messerli.Session.AspNetCore/Internal/Response.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public void SetHeader(string name, string value)
=> _httpContext.Response.Headers.Append(name, value);

public string? GetFirstHeaderValue(string name)
=> _httpContext.Response.Headers[name].FirstOrDefault();
=> _httpContext.Response.Headers.TryGetValue(name, out var value)
? value.FirstOrDefault()
: null;

private bool MapSecurePreferenceToBool(CookieSecurePreference securePreference)
=> securePreference switch
Expand Down

0 comments on commit 1712aa4

Please sign in to comment.