< Back
Write-PodeTextResponse
Post
NAME Write-PodeTextResponse
SYNOPSIS
Writes a String or a Byte[] to the Response.
SYNTAX
Write-PodeTextResponse [-Value <String>] [-ContentType <String>] [-MaxAge <Int32>] [-StatusCode <Int32>] [-Cache]
[<CommonParameters>]
Write-PodeTextResponse [-Bytes <Byte[]>] [-ContentType <String>] [-MaxAge <Int32>] [-StatusCode <Int32>] [-Cache]
[<CommonParameters>]
DESCRIPTION
Writes a String or a Byte[] to the Response, as some specified content type. This value can also be cached.
PARAMETERS
-Value <String>
A String value to write.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Bytes <Byte[]>
An array of Bytes to write.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ContentType <String>
The content type of the data being written.
Required? false
Position? named
Default value text/plain
Accept pipeline input? false
Accept wildcard characters? false
-MaxAge <Int32>
The maximum age to cache the value on the browser, in seconds.
Required? false
Position? named
Default value 3600
Accept pipeline input? false
Accept wildcard characters? false
-StatusCode <Int32>
The status code to set against the response.
Required? false
Position? named
Default value 200
Accept pipeline input? false
Accept wildcard characters? false
-Cache [<SwitchParameter>]
Should the value be cached by browsers, or not?
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:\\>Write-PodeTextResponse -Value 'Leeeeeerrrooooy Jeeeenkiiins!'
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Write-PodeTextResponse -Value '{"name": "Rick"}' -ContentType 'application/json'
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Write-PodeTextResponse -Bytes (Get-Content -Path ./some/image.png -Raw -AsByteStream) -Cache -MaxAge 1800
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Write-PodeTextResponse -Value 'Untitled Text Response' -StatusCode 418
RELATED LINKS
SYNOPSIS
Writes a String or a Byte[] to the Response.
SYNTAX
Write-PodeTextResponse [-Value <String>] [-ContentType <String>] [-MaxAge <Int32>] [-StatusCode <Int32>] [-Cache]
[<CommonParameters>]
Write-PodeTextResponse [-Bytes <Byte[]>] [-ContentType <String>] [-MaxAge <Int32>] [-StatusCode <Int32>] [-Cache]
[<CommonParameters>]
DESCRIPTION
Writes a String or a Byte[] to the Response, as some specified content type. This value can also be cached.
PARAMETERS
-Value <String>
A String value to write.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Bytes <Byte[]>
An array of Bytes to write.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ContentType <String>
The content type of the data being written.
Required? false
Position? named
Default value text/plain
Accept pipeline input? false
Accept wildcard characters? false
-MaxAge <Int32>
The maximum age to cache the value on the browser, in seconds.
Required? false
Position? named
Default value 3600
Accept pipeline input? false
Accept wildcard characters? false
-StatusCode <Int32>
The status code to set against the response.
Required? false
Position? named
Default value 200
Accept pipeline input? false
Accept wildcard characters? false
-Cache [<SwitchParameter>]
Should the value be cached by browsers, or not?
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:\\>Write-PodeTextResponse -Value 'Leeeeeerrrooooy Jeeeenkiiins!'
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Write-PodeTextResponse -Value '{"name": "Rick"}' -ContentType 'application/json'
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Write-PodeTextResponse -Bytes (Get-Content -Path ./some/image.png -Raw -AsByteStream) -Cache -MaxAge 1800
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Write-PodeTextResponse -Value 'Untitled Text Response' -StatusCode 418
RELATED LINKS