当前位置: 首页>>代码示例>>Java>>正文


Java Headers类代码示例

本文整理汇总了Java中io.restassured.http.Headers的典型用法代码示例。如果您正苦于以下问题:Java Headers类的具体用法?Java Headers怎么用?Java Headers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Headers类属于io.restassured.http包,在下文中一共展示了Headers类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createResponseLog

import io.restassured.http.Headers; //导入依赖的package包/类
private String createResponseLog(ValidatableResponse response) {
    ExtractableResponse extractableResponse = response.extract();

    StringBuilder builder = new StringBuilder();
    builder.append("RESPONSE: ");
    builder.append(extractableResponse.statusCode());
    builder.append(" - Headers: ");

    Headers headers = extractableResponse.headers();
    Map<String, String> headerMap = new HashMap<>();

    if (headers != null) {
        headers.forEach((header) -> headerMap.put(header.getName(), header.getValue()));
    }

    builder.append(headerMap);
    builder.append(NEW_LINE);
    builder.append(extractableResponse.body().asString());
    return builder.toString();
}
 
开发者ID:Atypon-OpenSource,项目名称:wayf-cloud,代码行数:21,代码来源:LoggingHttpRequestFactory.java

示例2: logHeaders

import io.restassured.http.Headers; //导入依赖的package包/类
/**
 * @author wasiq.bhamla
 * @since Sep 18, 2017 8:11:09 PM
 */
private void logHeaders () {
	final LoggingSetting logging = this.setting.getLogging ();
	if (logging.isLogHeaders ()) {
		final Headers headers = this.response.headers ();
		LOG.info (LINE);
		LOG.info ("Response Headers:");
		LOG.info (LINE);
		for (final Header header : headers.asList ()) {
			LOG.info (format ("%s: %s", header.getName (), header.getValue ()));
		}
	}
}
 
开发者ID:WasiqB,项目名称:coteafs-services,代码行数:17,代码来源:ResponseHandler.java

示例3: TracksResponse

import io.restassured.http.Headers; //导入依赖的package包/类
public TracksResponse(Response response) {
    this.statusCode = response.getStatusCode();

    this.responseHeaders = new HashMap<>();
    Headers headers = response.getHeaders();
    for(Header header: headers){
        responseHeaders.put(header.getName(), header.getValue());
    }

    this.body = response.body().asString();
}
 
开发者ID:eviltester,项目名称:tracksrestcasestudy,代码行数:12,代码来源:TracksResponse.java

示例4: cacheHeaders

import io.restassured.http.Headers; //导入依赖的package包/类
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());
    }
}
 
开发者ID:ctco,项目名称:cukes,代码行数:9,代码来源:HttpResponseFacade.java

示例5: snapshotNumberShouldBeLessThan10Digits

import io.restassured.http.Headers; //导入依赖的package包/类
@Test
public void snapshotNumberShouldBeLessThan10Digits() {
    FilterableRequestSpecification requestSpec = mock(FilterableRequestSpecification.class);
    when(requestSpec.getURI()).thenReturn("http://www.google.com");
    when(requestSpec.getHeaders()).thenReturn(new Headers());

    WebCustomRequest request = mapper.map(requestSpec);
    assertThat(request, hasProperty("snapshot", CustomMatchers.stringWithLength(lessThanOrEqualTo(15)))); //10 digits + t + .inf
}
 
开发者ID:ctco,项目名称:cukes,代码行数:10,代码来源:WebCustomRequestMapperTest.java

示例6: headersToValues

import io.restassured.http.Headers; //导入依赖的package包/类
protected Values headersToValues(Headers headers) {
    final Values headerValues = new Values();
    for (final Header header : headers) {
        headerValues.addValue(header.getName(), header.getValue());
    }
    return headerValues;
}
 
开发者ID:nidi3,项目名称:raml-tester,代码行数:8,代码来源:RestAssuredRamlMessage.java

示例7: headers

import io.restassured.http.Headers; //导入依赖的package包/类
/**
 * @author wasiq.bhamla
 * @since Aug 26, 2017 3:43:56 PM
 * @return headers
 */
public Headers headers () {
	return this.response.headers ();
}
 
开发者ID:WasiqB,项目名称:coteafs-services,代码行数:9,代码来源:ResponseHandler.java


注:本文中的io.restassured.http.Headers类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。