Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [0.5.1] - 2026-04-24
### Changed
- Added support for 'method' parameter on Replacer 'add_rule'

## [0.5.0] - 2025-12-15
### Added
- Add the APIs of the following add-ons:
Expand Down
6 changes: 4 additions & 2 deletions src/zapv2/replacer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# ZAP is an HTTP/HTTPS proxy for assessing web application security.
#
# Copyright 2025 the ZAP development team
# Copyright 2026 the ZAP development team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,7 +35,7 @@ def rules(self):
"""
return six.next(six.itervalues(self.zap._request(self.zap.base + 'replacer/view/rules/')))

def add_rule(self, description, enabled, matchtype, matchregex, matchstring, replacement=None, initiators=None, url=None, apikey=''):
def add_rule(self, description, enabled, matchtype, matchregex, matchstring, replacement=None, initiators=None, url=None, method=None, apikey=''):
"""
Adds a replacer rule. For the parameters: desc is a user friendly description, enabled is true or false, matchType is one of [REQ_HEADER, REQ_HEADER_STR, REQ_BODY_STR, RESP_HEADER, RESP_HEADER_STR, RESP_BODY_STR], matchRegex should be true if the matchString should be treated as a regex otherwise false, matchString is the string that will be matched against, replacement is the replacement string, initiators may be blank (for all initiators) or a comma separated list of integers as defined in <a href="https://www.zaproxy.org/docs/constants/">Request Initiator Constants</a>
This component is optional and therefore the API will only work if it is installed
Expand All @@ -47,6 +47,8 @@ def add_rule(self, description, enabled, matchtype, matchregex, matchstring, rep
params['initiators'] = initiators
if url is not None:
params['url'] = url
if method is not None:
params['method'] = method
return six.next(six.itervalues(self.zap._request(self.zap.base + 'replacer/action/addRule/', params)))

def remove_rule(self, description, apikey=''):
Expand Down