Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于cookies #28

Open
wenbochang888 opened this issue Oct 2, 2018 · 3 comments
Open

关于cookies #28

wenbochang888 opened this issue Oct 2, 2018 · 3 comments

Comments

@wenbochang888
Copy link

如果我本地已经获取到了cookies,如何根据cookies来访问登陆的网站。
HttpConfig里面的context和header都设置过了,返回的仍然是没有登陆过的页面

@Arronlong
Copy link
Owner

  1. 通过restful等工具测试是否能通过,如果这个都通不过,那用程序也一样。
  2. 第一步测试通过,就此方式传参,设置cookie等,可以参考test包路径下的测试demo

@wenbochang888
Copy link
Author

  1. 通过restful等工具测试是否能通过,如果这个都通不过,那用程序也一样。
  2. 第一步测试通过,就此方式传参,设置cookie等,可以参考test包路径下的测试demo

通过用户名和密码登陆然后在获取cookie,放到context中就可以获取登陆后页面

但我拿到浏览器登陆过后的cookie,然后用python或者postman都是可以成功的,唯独在springboot中失败,包括设置其他参数。如referer,us-agent等

String cookies = "thi is cookie"; String referer = "https://www.baidu.com"; Header[] headers=HttpHeader.custom().cookie(cookies).referer(referer).build(); HttpConfig config = HttpConfig.custom().headers(headers); return config;

@Arronlong
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants