Write-KrResponse

SYNOPSIS

Writes a response with the specified input object and HTTP status code.

SYNTAX

__AllParameterSets

Write-KrResponse [-InputObject] <Object> [[-StatusCode] <int>] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

This function is a wrapper around the Kestrun server response methods. The response format based on the Accept header or defaults to text/plain. Content type is determined automatically.

EXAMPLES

EXAMPLE 1

Write-KrResponse -InputObject $myObject -StatusCode 200 Writes the $myObject to the response with a 200 status code. The content type is determined automatically based on the Accept header or defaults to text/plain.

PARAMETERS

-InputObject

The input object to write to the response body.

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  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: ''

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

OUTPUTS

NOTES

This function is designed to be used in the context of a Kestrun server response.

{{ Fill in the related links here }}