Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Question on HTTP Sender

30 views
Skip to first unread message

Caubi Oliveira

unread,
Mar 6, 2025, 7:47:07 AMMar 6
to ZAP User Group
Hi, Team,

I was told to use httpsender to filter out some Methods (POST, PATCH, DELETE, and PUT). 

However, when I do it on the sendingRequest and I set the expected status code (msg.getResponseHeader().setStatusCode(405)), in the responseReceived, the status code is not the one I've set, and actually the one that was processed, like 202 (Accepted).

So, I was wondering if there is something I can do on the Request itself so that when the request is processed, we don't have any action done.

JS script is attached.

Kind regards,
Caubi

httprequest.js.txt

Simon Bennetts

unread,
Mar 11, 2025, 5:46:18 AMMar 11
to ZAP User Group
Hi Caubi,

While you can set the response header and body when sending a request they will always get overwritten when the release response is received.
Changing the response before the request is sent is "too early" and changing it when the real response is received is "too late".
What you need to do is to change the request so that it no longer causes the processing that you want to avoid.

Say you have an action you want to avoid at https://www.example.com/dostuff
If the request reaches that endpoint then the server will "dostuff" no matter how you change the response.
What you can do is change the request to something like https://www.example.com/donothing

Does that make sense?

Cheers,

Simon
Reply all
Reply to author
Forward
0 new messages