io.restassured.http.Header.getValue()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中io.restassured.http.Header.getValue()方法的一些代码示例,展示了Header.getValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.getValue()方法的具体详情如下:
包路径:io.restassured.http.Header
类名称:Header
方法名:getValue

Header.getValue介绍

暂无

代码示例

代码示例来源:origin: rest-assured/rest-assured

public String getRequestContentType() {
  Header header = requestHeaders.get(CONTENT_TYPE);
  if (header != null) {
    return header.getValue();
  }
  return null;
}

代码示例来源:origin: rest-assured/rest-assured

public static String getRequestContentType(Headers requestHeaders) {
  Header header = requestHeaders.get(CONTENT_TYPE);
  if (header != null) {
    return header.getValue();
  }
  return null;
}

代码示例来源:origin: rest-assured/rest-assured

public String getRequestContentType() {
  Header header = requestHeaders.get(CONTENT_TYPE);
  if (header != null) {
    return header.getValue();
  }
  return null;
}

代码示例来源:origin: rest-assured/rest-assured

private static String toString(Headers headers) {
  if (!headers.exist()) {
    return "";
  }
  final StringBuilder builder = new StringBuilder();
  for (Header header : headers) {
    builder.append(header.getName())
        .append(HEADER_NAME_AND_VALUE_SEPARATOR)
        .append(header.getValue())
        .append(SystemUtils.LINE_SEPARATOR);
  }
  builder.delete(builder.length() - SystemUtils.LINE_SEPARATOR.length(), builder.length());
  return builder.toString();
}

代码示例来源:origin: rest-assured/rest-assured

private void addRequestElements(HttpMethod method, String requestContentType, WebTestClient.RequestBodySpec requestBodySpec) {
  verifyNoBodyAndMultipartTogether();
  if (isNotBlank(requestContentType)) {
    requestBodySpec.contentType(parseMediaType(requestContentType));
  }
  applyRequestBody(requestBodySpec);
  applyMultipartBody(method, requestBodySpec);
  applyAttributes(requestBodySpec);
  headers.forEach(header -> requestBodySpec.header(header.getName(), header.getValue()));
  cookies.asList().forEach(cookie -> requestBodySpec.cookie(cookie.getName(), cookie.getValue()));
}

代码示例来源:origin: rest-assured/rest-assured

request.header(header.getName(), header.getValue());

代码示例来源:origin: spring-projects/spring-restdocs

private boolean isAllMediaTypesAcceptHeader(Header header) {
  return HttpHeaders.ACCEPT.equals(header.getName())
      && "*/*".equals(header.getValue());
}

代码示例来源:origin: spring-projects/spring-restdocs

private HttpHeaders extractHeaders(Response response) {
  HttpHeaders httpHeaders = new HttpHeaders();
  for (Header header : response.getHeaders()) {
    httpHeaders.add(header.getName(), header.getValue());
  }
  return httpHeaders;
}

代码示例来源:origin: spring-projects/spring-restdocs

private HttpHeaders extractHeaders(FilterableRequestSpecification requestSpec) {
  HttpHeaders httpHeaders = new HttpHeaders();
  for (Header header : requestSpec.getHeaders()) {
    if (!isAllMediaTypesAcceptHeader(header)) {
      httpHeaders.add(header.getName(), header.getValue());
    }
  }
  return httpHeaders;
}

代码示例来源:origin: io.rest-assured/spring-commons

public static String getRequestContentType(Headers requestHeaders) {
  Header header = requestHeaders.get(CONTENT_TYPE);
  if (header != null) {
    return header.getValue();
  }
  return null;
}

代码示例来源:origin: com.adobe.ride/ride-core

/**
 * Parses the headers returned in the call and formats them for reporting.
 * 
 * @param headers construction method for getting a serialized list of the the headers used in the
 *        call
 * @return String
 */
private String getHeaderString(Headers headers) {
 String returnString = "";
 boolean first = true;
 for (Header h : headers) {
  if (first) {
   returnString += " " + h.getName() + ": " + h.getValue() + System.lineSeparator();
   first = false;
  } else {
   returnString += " " + h.getName() + ": " + h.getValue() + System.lineSeparator();
  }
 }
 return returnString;
}

代码示例来源:origin: epam/JDI

public void addHeader(Header header) {
  addHeader(header.getName(), header.getValue());
}
public void addHeaders(com.epam.http.annotations.Header... headers) {

代码示例来源:origin: nidi3/raml-tester

protected Values headersToValues(Headers headers) {
  final Values headerValues = new Values();
  for (final Header header : headers) {
    headerValues.addValue(header.getName(), header.getValue());
  }
  return headerValues;
}

代码示例来源:origin: guru.nidi.raml/raml-tester

Values headersToValues(Headers headers) {
  final Values headerValues = new Values();
  for (final Header header : headers) {
    headerValues.addValue(header.getName(), header.getValue());
  }
  return headerValues;
}

代码示例来源:origin: ctco/cukes

public WebAddHeader map(Header header) {
    WebAddHeader result = new WebAddHeader();
    result.setName(header.getName());
    result.setValue(header.getValue());

    return result;
  }
}

代码示例来源:origin: lv.ctco.cukesrest/cukes-rest-loadrunner

public WebAddHeader map(Header header) {
    WebAddHeader result = new WebAddHeader();
    result.setName(header.getName());
    result.setValue(header.getValue());

    return result;
  }
}

代码示例来源:origin: ctco/cukes

private void cacheHeaders(Response response) {
  clearOldHeaders();
  Headers headers = response.getHeaders();
  for (Header header : headers) {
    String headerName = CukesOptions.HEADER_PREFIX + header.getName();
    world.put(headerName, header.getValue());
  }
}

代码示例来源:origin: lv.ctco.cukes/cukes-http

private void cacheHeaders(Response response) {
  clearOldHeaders();
  Headers headers = response.getHeaders();
  for (Header header : headers) {
    String headerName = CukesOptions.HEADER_PREFIX + header.getName();
    world.put(headerName, header.getValue());
  }
}

代码示例来源:origin: com.atlassian.oai/swagger-request-validator-restassured

/**
   * Builds a {@link Response} for the OpenAPI validator out of the
   * original {@link io.restassured.response.Response}.
   *
   * @param originalResponse the original {@link io.restassured.response.Response}
   */
  @Nonnull
  public static Response of(@Nonnull final io.restassured.response.Response originalResponse) {
    requireNonNull(originalResponse, "An original response is required");
    final SimpleResponse.Builder builder = new SimpleResponse.Builder(originalResponse.getStatusCode())
        .withBody(originalResponse.getBody().asString());
    if (originalResponse.getHeaders() != null) {
      originalResponse.getHeaders().forEach(header -> builder.withHeader(header.getName(), header.getValue()));
    }
    return builder.build();
  }
}

代码示例来源:origin: com.atlassian.oai/swagger-request-validator-restassured

.withBody(originalRequest.getBody());
if (originalRequest.getHeaders() != null) {
  originalRequest.getHeaders().forEach(header -> builder.withHeader(header.getName(), header.getValue()));

相关文章