@Override public String toString() { try { StringBuilder stringBuffer = new StringBuilder(); stringBuffer.append(this.getUrl().toString()); // Append body if it is a post or put String method = getMethod(); if (HTTPConstants.POST.equals(method) || HTTPConstants.PUT.equals(method)) { stringBuffer.append("\nQuery Data: "); stringBuffer.append(getQueryString()); } return stringBuffer.toString(); } catch (MalformedURLException e) { return ""; } }
/** * Set method on sampler * @param sampler {@link HTTPSamplerBase} * @param request {@link HttpRequestHdr} */ protected void computeMethod(HTTPSamplerBase sampler, HttpRequestHdr request) { sampler.setMethod(request.getMethod()); log.debug("Proxy: setting method: " + sampler.getMethod()); }
/** * Sets the PATH property; if the request is a GET or DELETE (and the path * does not start with http[s]://) it also calls {@link #parseArguments(String, String)} * to extract and store any query arguments. * * @param path * The new Path value * @param contentEncoding * The encoding used for the querystring parameter values */ public void setPath(String path, String contentEncoding) { boolean fullUrl = path.startsWith(HTTP_PREFIX) || path.startsWith(HTTPS_PREFIX); String method = getMethod(); boolean getOrDelete = HTTPConstants.GET.equals(method) || HTTPConstants.DELETE.equals(method); if (!fullUrl && getOrDelete) { int index = path.indexOf(QRY_PFX); if (index > -1) { setProperty(PATH, path.substring(0, index)); // Parse the arguments in querystring, assuming specified encoding for values parseArguments(path.substring(index + 1), contentEncoding); } else { setProperty(PATH, path); } } else { setProperty(PATH, path); } }
/** * Determine if we should use multipart/form-data or * application/x-www-form-urlencoded for the post * * @return true if multipart/form-data should be used and method is POST */ public boolean getUseMultipartForPost() { // We use multipart if we have been told so, or files are present // and the files should not be send as the post body HTTPFileArg[] files = getHTTPFiles(); return HTTPConstants.POST.equals(getMethod()) && (getDoMultipart() || (files.length > 0 && hasNoMissingFile(files) && !getSendFileAsPostBody())); }
String method = getMethod(); if (PROTOCOL_FILE.equalsIgnoreCase(protocol)) {
if (url.getMethod().equals(HTTPConstants.POST)) { for (JMeterProperty jMeterProperty : sampler.getArguments()) { Argument arg = (Argument) jMeterProperty.getObjectValue();
/** * Perform a sample, and return the results * * @return results of the sampling */ public SampleResult sample() { SampleResult res = null; try { res = sample(getUrl(), getMethod(), false, 0); if (res != null) { res.setSampleLabel(getName()); } return res; } catch (Exception e) { return errorResult(e, new HTTPSampleResult()); } }
|| HTTPConstants.PUT.equals(sampler.getMethod()) || isPotentialXml(postData)) { sampler.addNonEncodedArgument("", postData, "");
log.debug("{} Execute sample: {} and url {}",port, sampler.getMethod(), sampler.getUrl());
if (url.getMethod().equals(HTTPConstants.POST)) { PropertyIterator iter = sampler.getArguments().iterator(); while (iter.hasNext()) {