Skip to content

Add-PodeBodyParser

SYNOPSIS

Adds a custom body parser middleware.

SYNTAX

Add-PodeBodyParser [-ContentType] <String> [-ScriptBlock] <ScriptBlock> [<CommonParameters>]

DESCRIPTION

Adds a custom body parser middleware script for a content-type, which will be used if a payload is sent with a Request.

EXAMPLES

EXAMPLE 1

Add-PodeBodyParser -ContentType 'application/json' -ScriptBlock { param($body) /* parsing logic */ }

PARAMETERS

-ContentType

The ContentType of the custom body parser.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ScriptBlock

The ScriptBlock that will parse the body content, and return the result.

Type: ScriptBlock
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES