本文整理汇总了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();
}
示例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 ()));
}
}
}
示例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();
}
示例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());
}
}
示例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
}
示例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;
}
示例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 ();
}