Test-KrRoute

SYNOPSIS

Tests if a route exists in the Kestrun host.

SYNTAX

Test-KrRoute [-Pattern] <String> [[-Verbs] <HttpVerb[]>] [<CommonParameters>]

DESCRIPTION

This function checks if a specific route is defined in the Kestrun host’s routing table.

EXAMPLES

EXAMPLE 1

Test-KrRoute -Path "/api/test" -Verbs "GET"
# Tests if a GET route exists for "/api/test".

EXAMPLE 2

Test-KrRoute -Path "/api/test" -Verbs "POST"
# Tests if a POST route exists for "/api/test".

PARAMETERS

-Pattern

The path of the route to test.

Type: String
Parameter Sets: (All)
Aliases: Path

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

-Verbs

The HTTP verb(s) to test for the route.

Type: HttpVerb[]
Parameter Sets: (All)
Aliases:
Accepted values: Get, Head, Post, Put, Patch, Delete, Options, Trace, PropFind, PropPatch, MkCol, Copy, Move, Lock, Unlock, Report, Acl, Search, Merge, Bind, Unbind, Rebind, Update, VersionControl, Checkin, Checkout, Uncheckout, MkWorkspace, Label, OrderPatch

Required: False
Position: 2
Default value: @([Kestrun.Utilities.HttpVerb]::Get)
Accept pipeline input: False
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

System.Boolean

NOTES

This function is part of the Kestrun PowerShell module and is used to manage routes.