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


Java Response.getHeader方法代码示例

本文整理汇总了Java中com.jayway.restassured.response.Response.getHeader方法的典型用法代码示例。如果您正苦于以下问题:Java Response.getHeader方法的具体用法?Java Response.getHeader怎么用?Java Response.getHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jayway.restassured.response.Response的用法示例。


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

示例1: create

import com.jayway.restassured.response.Response; //导入方法依赖的package包/类
public ObjectNode create(RequestSpecification request)
{
	final String resolvedPath = getResolvedPath();
	Response response = request.post(resolvedPath);
	String location = response.getHeader("Location");
	Assert.assertNotNull(location, "Location on create request to " + resolvedPath + " is null");
	ObjectNode object = object(successfulRequest().get(location));
	final ID id = getId(object);
	cleanUpController.addCleanup(new StandardCleanupAfter(id));
	return object;
}
 
开发者ID:equella,项目名称:Equella,代码行数:12,代码来源:AbstractCleanupRequests.java

示例2: uploadLarge

import com.jayway.restassured.response.Response; //导入方法依赖的package包/类
@Test(groups = "eps")
public void uploadLarge() throws IOException, DateParseException
{
	String stagingUrl = staging.create();

	File largeFile = File.createTempFile("large", "file");
	BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(largeFile));
	Random random = new Random();
	for( int i = 0; i < LARGE_FILE_SIZE; i++ )
	{
		out.write(random.nextInt());
	}
	out.close();
	largeFile.deleteOnExit();

	String uploadId = staging.startMultipart(stagingUrl, LARGE_PATH);
	long offset = 0;
	long length = largeFile.length();
	int partNum = 1;
	List<Integer> partNums = Lists.newArrayList();
	List<String> etags = Lists.newArrayList();
	while( offset < length )
	{
		long left = length - offset;
		long size = Math.min(left, MIN_PART_SIZE);
		partNums.add(partNum);
		etags.add(staging.uploadPart(stagingUrl, LARGE_PATH, uploadId, largeFile, partNum++, offset, size));
		offset += size;
	}
	String etag = staging.completeMultipart(stagingUrl, LARGE_PATH, uploadId, partNums, etags);
	Response response = staging.head(stagingUrl, LARGE_PATH);
	String lenHeader = response.getHeader("Content-Length");
	assertEquals(Long.parseLong(lenHeader), largeFile.length());
	assertEquals(response.getHeader("E-Tag"), etag);
	File downloadFile = File.createTempFile("large", "file");
	staging.downloadToFile(stagingUrl, LARGE_PATH, downloadFile);
	assertEquals(Files.hash(downloadFile, Hashing.md5()), Files.hash(largeFile, Hashing.md5()));
}
 
开发者ID:equella,项目名称:Equella,代码行数:39,代码来源:StagingApiTest.java


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