我想使用RestAssured框架来测试我的Java Spring API。API的工作方式是,您必须使用JSON格式的用户名和密码通过POST登录/session/login,例如:
{"username":"testuser","password":"testpassword"}
如果用户名和密码正确,则会返回一个会话cookie,然后可以使用该cookie来确定用户是否已登录。我似乎找不到一种方法来使用RestAssured的auth()函数来实现这一点。我该怎么做呢?
我有一个spring boot (1.3.2)应用程序,其中我实现了一个HttpSessionListener。我从@Configration类注册了监听器
@Configuration
@EnableRedisHttpSession
public class ApplicationSessionConfiguration {
@Bean
public ServletListenerRegistrationBean<HttpSessionListener> sessionListener() {
return new ServletListenerRegistration