@Override
  public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener)
      throws InterruptedException, IOException {
    final PrintStream logger = listener.getLogger();
    final EnvVars envVars = build.getEnvironment(listener);
    final VariableResolver<String> buildVariableResolver = build.getBuildVariableResolver();

    String evaluatedUrl = evaluate(url, buildVariableResolver, envVars);
    String evaluatedBody = evaluate(requestBody, buildVariableResolver, envVars);

    final List<HttpRequestNameValuePair> params = createParameters(build, logger, envVars);
    final List<HttpRequestNameValuePair> headers = new ArrayList<>();

    if (contentType != MimeType.NOT_SET) {
      headers.add(
          new HttpRequestNameValuePair("Content-type", contentType.getContentType().toString()));
    }
    if (acceptType != MimeType.NOT_SET) {
      headers.add(new HttpRequestNameValuePair("Accept", acceptType.getValue()));
    }
    for (HttpRequestNameValuePair header : customHeaders) {
      String headerName = evaluate(header.getName(), buildVariableResolver, envVars);
      String headerValue = evaluate(header.getValue(), buildVariableResolver, envVars);

      headers.add(new HttpRequestNameValuePair(headerName, headerValue));
    }

    RequestAction requestAction =
        new RequestAction(
            new URL(evaluatedUrl),
            httpMode,
            evaluatedBody,
            params,
            headers,
            contentType.getContentType());

    ResponseContentSupplier responseContentSupplier = performHttpRequest(listener, requestAction);

    logResponseToFile(build.getWorkspace(), logger, responseContentSupplier);
    return true;
  }
  public ResponseContentSupplier performHttpRequest(TaskListener listener)
      throws InterruptedException, IOException {
    List<HttpRequestNameValuePair> params = Collections.emptyList();
    List<HttpRequestNameValuePair> headers = new ArrayList<>();
    if (contentType != MimeType.NOT_SET) {
      headers.add(
          new HttpRequestNameValuePair("Content-type", contentType.getContentType().toString()));
    }
    if (acceptType != MimeType.NOT_SET) {
      headers.add(new HttpRequestNameValuePair("Accept", acceptType.getValue()));
    }
    for (HttpRequestNameValuePair header : customHeaders) {
      headers.add(new HttpRequestNameValuePair(header.getName(), header.getValue()));
    }

    RequestAction requestAction =
        new RequestAction(
            new URL(url), httpMode, requestBody, params, headers, contentType.getContentType());

    return performHttpRequest(listener, requestAction);
  }