< Summary - Kestrun — Combined Coverage

Information
Class: Public.Session.Set-KrSessionString
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Session/Set-KrSessionString.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 2
Coverable lines: 2
Total lines: 30
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 10/13/2025 - 16:52:37 Line coverage: 0% (0/2) Total lines: 30 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Session/Set-KrSessionString.ps1

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Sets a string value in the session by key.
 4    .DESCRIPTION
 5        This function accesses the current HTTP context's session and sets the string value
 6        associated with the specified key.
 7    .PARAMETER Key
 8        The key of the session item to set.
 9    .PARAMETER Value
 10        The string value to set in the session.
 11    .EXAMPLE
 12        Set-KrSessionString -Key "userName" -Value "JohnDoe"
 13        Sets the string value associated with the key "userName" in the session to "JohnDoe".
 14    .OUTPUTS
 15        None. This function performs a state-changing operation on the session.
 16#>
 17function Set-KrSessionString {
 18    [KestrunRuntimeApi('Route')]
 19    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')]
 20    [CmdletBinding()]
 21    param(
 22        [Parameter(Mandatory)]
 23        [string]$Key,
 24        [Parameter(Mandatory)]
 25        [string]$Value
 26    )
 027    if ($null -ne $Context.Session) {
 028        [Microsoft.AspNetCore.Http.SessionExtensions]::SetString($Context.Session, $Key, $Value)
 29    }
 30}

Methods/Properties

Set-KrSessionString()