Java 最大年龄<;0不受Rest Assured支持
在Cookie.java中,当我们发送最大年龄为负值的Cookie以使Cookie过期时,它会引发一个异常 这在他们的代码中很清楚Java 最大年龄<;0不受Rest Assured支持,java,cookies,playframework,rest-assured,Java,Cookies,Playframework,Rest Assured,在Cookie.java中,当我们发送最大年龄为负值的Cookie以使Cookie过期时,它会引发一个异常 这在他们的代码中很清楚 /** * Set the maximum age of the cookie, specified in seconds, * By default, <code>-1</code> indicating the cookie will persist * until browser shutdown. * * @return
/**
* Set the maximum age of the cookie, specified in seconds,
* By default, <code>-1</code> indicating the cookie will persist
* until browser shutdown.
*
* @return an integer specifying the maximum age of the
* cookie in seconds; if negative, means
* the cookie persists until browser shutdown
*/
public Builder setMaxAge(int maxAge) {
if(maxAge < 0) {
throw new IllegalArgumentException("Max-Age cannot be less than 0");
}
this.maxAge = maxAge;
return this;
}
然而,注释支持负值,并且明确指出负值意味着cookie将持续到浏览器关闭
他们有没有办法让我发送一个cookie来响应max age的负值,因为他们的代码中还没有处理这个问题?你能修改
cookie.jar
?我不想修改第三方库,那么你应该告诉编写库的人,因为这显然是他的错(可能是“阅读代码,文档就在这里”;)好吧,要么你自己修复这个库,要么你等到(但看起来开发人员并不关心这个bug)。