< Back

Set-PodeResponseStatus

Sat Jan 18, 2020 7:19 pm

NAME Set-PodeResponseStatus



SYNOPSIS

Sets the Status Code of the Response, and controls rendering error pages.





SYNTAX

Set-PodeResponseStatus [-Code] <Int32> [[-Description] <String>] [[-Exception] <Object>] [[-ContentType] <String>]

[-NoErrorPage] [<CommonParameters>]





DESCRIPTION

Sets the Status Code of the Response, and controls rendering error pages.





PARAMETERS

-Code <Int32>

The Status Code to set on the Response.



Required? true

Position? 1

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Description <String>

An optional Status Description.



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Exception <Object>

An exception to use when detailing error information on error pages.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ContentType <String>

The content type of the error page to use.



Required? false

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-NoErrorPage [<SwitchParameter>]

Don't render an error page when the Status Code is 400+.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Set-PodeResponseStatus -Code 404













-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Set-PodeResponseStatus -Code 500 -Exception $_.Exception













-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Set-PodeResponseStatus -Code 500 -Exception $_.Exception -ContentType 'application/json'















RELATED LINKS