< Summary - Kestrun — Combined Coverage

Information
Class: Public.Response.Write-KrCborResponse
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Response/Write-KrCborResponse.ps1
Tag: Kestrun/Kestrun@9d3a582b2d63930269564a7591aa77ef297cadeb
Line coverage
0%
Covered lines: 0
Uncovered lines: 2
Coverable lines: 2
Total lines: 33
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

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Response/Write-KrCborResponse.ps1

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Writes an object serialized as CBOR to the HTTP response.
 4    .DESCRIPTION
 5        Converts the provided object to CBOR format and writes it to the response body. The status code and content type
 6    .PARAMETER InputObject
 7        The object to serialize and write to the response.
 8    .PARAMETER StatusCode
 9        The HTTP status code to set for the response. Defaults to 200.
 10    .PARAMETER ContentType
 11        The content type to set for the response. If not specified, defaults to application/cbor
 12    .EXAMPLE
 13        Write-KrCborResponse -InputObject $myObject -StatusCode 200 -ContentType "application/cbor"
 14        Writes the $myObject serialized as CBOR to the response with a 200 status code and
 15        content type "application/cbor".
 16#>
 17function Write-KrCborResponse {
 18    [KestrunRuntimeApi('Route')]
 19    [CmdletBinding()]
 20    param(
 21        [Parameter(Mandatory = $true)]
 22        [object]$InputObject,
 23        [Parameter()]
 24        [int]$StatusCode = 200,
 25        [Parameter()]
 26        [string]$ContentType
 27    )
 028    if ($null -ne $Context.Response) {
 29        # Call the C# method on the $Context.Response object
 030        $Context.Response.WriteCborResponse($InputObject, $StatusCode, $ContentType)
 31    }
 32}
 33

Methods/Properties

Write-KrCborResponse()