@PluginRequestFilter

Applies to ReadyAPI 3.9, last modified on July 16, 2021

PluginRequestFilter creates a custom Request filter which is applied to all outgoing requests.

Filters are used for modifying incoming/outgoing messages, for example to add tokens or contents, to apply transformations or to perform validations.

The protocol property defines which URL protocol the filter applies to.

The annotated class must implement the RequestFilter interface.

Sample Request Filter

package com.smartbear.ready.plugin.template.factories;

import com.eviware.soapui.impl.support.AbstractHttpRequestInterface;
import com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter;
import com.eviware.soapui.impl.wsdl.submit.transports.http.BaseHttpRequestTransport;
import com.eviware.soapui.impl.wsdl.submit.transports.http.HttpResponse;
import com.eviware.soapui.model.iface.SubmitContext;
import com.eviware.soapui.plugins.auto.PluginRequestFilter;

/**
*
*/

@PluginRequestFilter(protocol = "http")
public class SampleRequestFilter extends AbstractRequestFilter {
@Override
public void afterAbstractHttpResponse(SubmitContext context, AbstractHttpRequestInterface<?> request) {
HttpResponse response = (HttpResponse) context.getProperty(BaseHttpRequestTransport.RESPONSE);
response.setProperty("Secret Message", "Msg");
}
}
Highlight search results