Skip to content

A free, open-source alternative to Burp Suite: an intercepting proxy and web app security testing suite with Repeater, Intruder, Collaborator and a built-in OWASP ZAP scanner. Linux, AGPL-3.0.

1.1 KB
Raw Blame
package opensuite.script.api;

/**
 * What a custom action is run on: the request being edited and, when there is
 * one, the response shown beside it. An action changes the request by handing
 * a new one to {@link #setRequest}; it takes effect only if the action ends
 * without an error.
 */
public final class HttpRequestResponse {

    private final HttpRequest request;
    private final HttpResponse response;
    private HttpRequest replacement;

    public HttpRequestResponse(HttpRequest request, HttpResponse response) {
        this.request = request;
        this.response = response;
    }

    public HttpRequest request() { return request; }

    /** The response, or null when there is none yet. */
    public HttpResponse response() { return response; }

    public boolean hasResponse() { return response != null; }

    /** Put {@code changed} in place of the request being edited, once the action has ended. */
    public void setRequest(HttpRequest changed) { this.replacement = changed; }

    /** The request handed to {@link #setRequest}, or null. */
    public HttpRequest replacement() { return replacement; }
}