我使用Spring Boot创建了一个文件上传服务,并使用Spring Mock Mvc和MockMultipartFile进行测试.我想测试是否在超出最大文件大小时抛出错误.以下测试失败,因为它收到200.
RandomAccessFile f = new RandomAccessFile("t", "rw");
f.setLength(1024 * 1024 * 10);
InputStream is = Channels.newInputStream(f.getChannel());
MockMultipartFile firstFile = new MockMultipartFile("data", "file1.txt", "text/plain", is);
mvc.perform(fileUpload("/files")
.file(firstFile))
.andExpect(status().isInternalServerError());
Run Code Online (Sandbox Code Playgroud)
有没有可能测试上传文件的大小?
最近我在Spring 4中尝试了新的内置CORS-Support.这个功能很棒,我想在Spring Boot/AngularJS应用程序中实现它.
所有请求都正常但我无法注销我的用户,因为
OPTIONS-Request to/logout由Spring Security处理.
是否有可能处理OPTIONS之前-请求的Spring Security或者我应该附上CORS报头中LogoutSuccessHandler?