Write-KrCsvResponse
SYNOPSIS
Writes CSV data to the HTTP response body.
SYNTAX
__AllParameterSets
Write-KrCsvResponse [-InputObject] <Object> [[-StatusCode] <int>] [[-ContentType] <string>]
[[-Delimiter] <char>] [[-QuoteFields] <string[]>] [[-UseQuotes] <BaseCsvWritingCommand+QuoteKind>]
[-IncludeTypeInformation] [-NoHeader] [<CommonParameters>]
ALIASES
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION
Sends a raw CSV payload to the client and optionally sets the HTTP status code and content type.
EXAMPLES
EXAMPLE 1
Write-KrCsvResponse -InputObject “Name,AgenAlice,30nBob,25” -StatusCode 200 Writes the CSV data to the response body with a 200 OK status code.
PARAMETERS
-ContentType
The content type of the response. If not specified, defaults to “text/csv”.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Delimiter
The character to use as the delimiter in the CSV output. Defaults to a comma (,).
Type: System.Char
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 3
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-IncludeTypeInformation
Switch to include type information in the CSV output.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-InputObject
The CSV content to write to the response body. This can be a string or any other object that can be converted to a string.
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-NoHeader
Switch to omit the header row from the CSV output.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-QuoteFields
An array of field names to always quote in the CSV output.
Type: System.String[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 4
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-StatusCode
The HTTP status code to set for the response. Defaults to 200 (OK).
Type: System.Int32
DefaultValue: 200
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-UseQuotes
Specifies how to quote fields in the CSV output. Accepts values from the Microsoft.PowerShell.Commands.BaseCsvWritingCommand+QuoteKind enum.
Type: Microsoft.PowerShell.Commands.BaseCsvWritingCommand+QuoteKind
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 5
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
System.Object
{{ Fill in the Description }}
OUTPUTS
NOTES
This function is designed to be used in the context of a Kestrun server response.
RELATED LINKS
{{ Fill in the related links here }}