diff --git a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java index f15c2c0d73..ff2a7bf0fd 100644 --- a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java +++ b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java @@ -219,14 +219,19 @@ public class HTTPHC3Impl extends HTTPHCAbstractImpl { } else if (method.equals(HTTPConstants.OPTIONS)){ httpMethod = new OptionsMethod(urlStr); } else if (method.equals(HTTPConstants.DELETE)){ - httpMethod = new DeleteMethod(urlStr); + httpMethod = new EntityEnclosingMethod(urlStr) { + @Override + public String getName() { // HC3.1 does not have the method + return HTTPConstants.DELETE; + } + }; } else if (method.equals(HTTPConstants.GET)){ httpMethod = new GetMethod(urlStr); } else if (method.equals(HTTPConstants.PATCH)){ httpMethod = new EntityEnclosingMethod(urlStr) { @Override public String getName() { // HC3.1 does not have the method - return "PATCH"; + return HTTPConstants.PATCH; } }; } else { @@ -254,7 +259,8 @@ public class HTTPHC3Impl extends HTTPHCAbstractImpl { if (method.equals(HTTPConstants.POST)) { String postBody = sendPostData((PostMethod)httpMethod); res.setQueryString(postBody); - } else if (method.equals(HTTPConstants.PUT) || method.equals(HTTPConstants.PATCH)) { + } else if (method.equals(HTTPConstants.PUT) || method.equals(HTTPConstants.PATCH) + || method.equals(HTTPConstants.DELETE)) { String putBody = sendEntityData((EntityEnclosingMethod) httpMethod); res.setQueryString(putBody); } @@ -959,7 +965,7 @@ public class HTTPHC3Impl extends HTTPHCAbstractImpl { } /** - * Set up the PUT/PATCH data + * Set up the PUT/PATCH/DELETE data */ private String sendEntityData(EntityEnclosingMethod put) throws IOException { // Buffer to hold the put body, except file content diff --git a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java index 231f81b251..444357c141 100644 --- a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java +++ b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java @@ -55,7 +55,6 @@ import org.apache.http.client.CredentialsProvider; import org.apache.http.client.HttpClient; import org.apache.http.client.HttpRequestRetryHandler; import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; @@ -220,6 +219,19 @@ public class HTTPHC4Impl extends HTTPHCAbstractImpl { super(testElement); } + public static final class HttpDelete extends HttpEntityEnclosingRequestBase { + + public HttpDelete(final URI uri) { + super(); + setURI(uri); + } + + @Override + public String getMethod() { + return HTTPConstants.DELETE; + } + } + @Override protected HTTPSampleResult sample(URL url, String method, boolean areFollowingRedirect, int frameDepth) { @@ -380,7 +392,8 @@ public class HTTPHC4Impl extends HTTPHCAbstractImpl { if (method.equals(HTTPConstants.POST)) { String postBody = sendPostData((HttpPost)httpRequest); result.setQueryString(postBody); - } else if (method.equals(HTTPConstants.PUT) || method.equals(HTTPConstants.PATCH)) { + } else if (method.equals(HTTPConstants.PUT) || method.equals(HTTPConstants.PATCH) + || method.equals(HTTPConstants.DELETE)) { String entityBody = sendEntityData(( HttpEntityEnclosingRequestBase)httpRequest); result.setQueryString(entityBody); } diff --git a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java index 0b8b0856e1..1d88c64806 100644 --- a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java +++ b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java @@ -135,7 +135,9 @@ public class HTTPSampleResult extends SampleResult { sb.append(u.toString()); sb.append("\n"); // Include request body if it is a post or put or patch - if (HTTPConstants.POST.equals(method) || HTTPConstants.PUT.equals(method) || HTTPConstants.PATCH.equals(method)) { + if (HTTPConstants.POST.equals(method) || HTTPConstants.PUT.equals(method) + || HTTPConstants.PATCH.equals(method) + || HTTPConstants.DELETE.equals(method)) { sb.append("\n"+method+" data:\n"); sb.append(queryString); sb.append("\n"); diff --git a/xdocs/changes.xml b/xdocs/changes.xml index 9437db36c8..71cc831cb5 100644 --- a/xdocs/changes.xml +++ b/xdocs/changes.xml @@ -238,6 +238,7 @@ Transaction Controller now sets Response Code of Generated Parent Sampler (if Ge