OkHttp 3 如何创建以“.”开头的 cookie 域
我正在使用 okhttp 3 create cookie
var c1 = new Cookie.Builder()
.path("/")
.domain(".test.org")
.name("cookie-name")
.value("cookie-value")
.httpOnly().secure().build();
发生异常
“java.lang.IllegalArgumentException:意外的域:.test.org” .domain(".test.org")
我应该怎么做才能在 cookie 中创建域,第一个字符是“.”
I am using okhttp 3 create cookie
var c1 = new Cookie.Builder()
.path("/")
.domain(".test.org")
.name("cookie-name")
.value("cookie-value")
.httpOnly().secure().build();
An exception occurred
"java.lang.IllegalArgumentException:unexpected domain: .test.org" in.domain(".test.org")
what should I do to create the domain in the cookie is the first character is '.'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以省略前导
.
而不会改变行为。来自 RFC 6265:You can omit the leading
.
without a change in behavior. From RFC 6265: