Use regex in Killgrave imposters
mainKillgrave supports regex for matching endpoints, query parameters, and headers.
- Endpoints: Uses
gorilla/muxregex format. Example:/gophers/{_id:[\w]{26}}. - Query Parameters: Uses
gorilla/muxregex format within theparamsobject. Example:"apiKey": "{_apiKey:[\w]+}". - Headers: Uses standard regex (no
gorilla/muxsyntax required). Example:"Authorization": "\\w+".
Note: Remember to escape special characters in JSON strings.
// Regex in endpoint
{
"request": {
"method": "GET",
"endpoint": "/gophers/{_id:[\\w]{26}}"
}
}
// Regex in query params
{
"request": {
"method": "GET",
"endpoint": "/gophers/{_id:[\\w]{26}}",
"params": {
"apiKey": "{_apiKey:[\\w]+}"
}
}
}
// Regex in headers
{
"request": {
"method": "GET",
"endpoint": "/gophers/{id:[\\w]{26}}",
"headers": {
"Authorization": "\\w+"
}
}
}