Interface HttpSenderScript


  • public interface HttpSenderScript
    A script that is executed for each HTTP message sent by/through ZAP.

    The IDs of the initiators are defined in the HttpSender class (for example, SPIDER_INITIATOR).

    Note: In the presence of more than one script or, internally, a HttpSenderListener there are no guarantees that the (final) request/response is exactly the same as the one crafted by this script, as the following scripts/listeners may modify it.

    Since:
    2.4.1
    • Method Detail

      • sendingRequest

        void sendingRequest​(HttpMessage msg,
                            int initiator,
                            HttpSenderScriptHelper helper)
                     throws javax.script.ScriptException
        Called before sending the request to the server.

        Only the request should be modified.

        Parameters:
        msg - the HTTP message (request) being sent.
        initiator - the ID of the initiator of the HTTP message being sent.
        helper - the helper class that allows to send other HTTP messages.
        Throws:
        javax.script.ScriptException - if an error occurred while executing the script.
      • responseReceived

        void responseReceived​(HttpMessage msg,
                              int initiator,
                              HttpSenderScriptHelper helper)
                       throws javax.script.ScriptException
        Called after receiving the response from the server (if any).
        Parameters:
        msg - the HTTP message (response) received.
        initiator - the ID of the initiator of the HTTP message sent.
        helper - the helper class that allows to send other HTTP messages.
        Throws:
        javax.script.ScriptException - if an error occurred while executing the script.