如何在空手道中设置大Cookie标头 [英] How to set big cookie header in karate

查看:135
本文介绍了如何在空手道中设置大Cookie标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为我们自动化的一部分,我们需要将非常大的cookie标头发送到api.

As part of our automation we need to send very huge cookie header to the api.

cookie如下 Cookie:_ga = GA1.2.1041556506.1557744563; _gcl_au = 1.1.139136457.1560512273; JabmoSP0id.ffef = d37c42bf-f223-43c6-a73c-fa502e23712d.1560512274.5.1561197329.1560589232.2561e1f4-79fe-4b63-88c6-157c6e8ed125; _gid = GA1.2.1289186220.1561356841; intercom-session-pk0ds0sg = TlZDS2xJQ3BjdldKQ3QzVkt2U1VkUUJ0WmhsVDBpaTY0YThBR0M0Y0dFMWs1azkwUlBlTWpUbWp1ZHN6MUtydS0tZm5CSlZY21a24k7b1k1k2k7k1k1k2k7k1k2k7k1k7k1k6k7k7k1k7k1k7k1k2k7k7k7k1k7k1k7k1k7k7k7k1k7k7a路线= lj-01;登录=; lang = en; _ga = GA1.4.1041556506.1557744563; _gid = GA1.4.1289186220.1561356841; _pendo_accountId.029f7ddf-6593-4d82-5a65-a6c66fbf2b5c = AnupamaSoftwareAG; _pendo_visitorId.029f7ddf-6593-4d82-5a65-a6c66fbf2b5c = fldf7517754d071b07cb0e77; _pendo_meta.029f7ddf-6593-4d82-5a65-a6c66fbf2b5c = 1358353967; userId = -2; JSESSIONID = CFDB00B95AF1C731356A04B01FF369E3; mp_62107c6714e5356c33d43ef8d8f43cee_mixpanel =%7B%22distinct_id%22%3A%20%22fldf7517754d071b07cb0e77%22%2C%22%24device_id%22%3A%20%2216ab0cfc07a1b8%c%22cf3c3a3c3c3c3c3f3c3c3c3c3e0c6e0f0e0c0e0e0e0e0e0e0e0e0%人%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%2C%22%24user_id%22%3A%20%22fldf7517754d071b07cb0e77%22%7D; intercom-session-no8pg948 = emh3RjRGVzVmczQrTFdUaUZwWWliRTRBaDNlOEtmQ1VHcjh0NWl5eTZPNXVSdHdMU2VjMW9rRmt3WWZ0Q200Mi0tRitFT0Y1dkp6S2cvdkQ6f9b24f9b2f9b2f9b2f9b2f9b2f9b2f9b2f9b1e0f0b0e0f0b0f0b0e0f0b0f0b人_gat_UA-60405455-1 = 1

cookie is as below cookie: _ga=GA1.2.1041556506.1557744563; _gcl_au=1.1.139136457.1560512273; JabmoSP0id.ffef=d37c42bf-f223-43c6-a73c-fa502e23712d.1560512274.5.1561197329.1560589232.2561e1f4-79fe-4b63-88c6-157c6e8ed125; _gid=GA1.2.1289186220.1561356841; intercom-session-pk0ds0sg=TlZDS2xJQ3BjdldKQ3QzVkt2U1VkUUJ0WmhsVDBpaTY0YThBR0M0Y0dFMWs1azkwUlBlTWpUbWp1ZHN6MUtydS0tZm5CSlZYU0VPQnVJS1k1aFM2dkxkdz09--d615bb61f58bf243d7d949136c2d05d26aaac49a; route=lj-01; login=; lang=en; _ga=GA1.4.1041556506.1557744563; _gid=GA1.4.1289186220.1561356841; _pendo_accountId.029f7ddf-6593-4d82-5a65-a6c66fbf2b5c=AnupamaSoftwareAG; _pendo_visitorId.029f7ddf-6593-4d82-5a65-a6c66fbf2b5c=fldf7517754d071b07cb0e77; _pendo_meta.029f7ddf-6593-4d82-5a65-a6c66fbf2b5c=1358353967; userId=-2; JSESSIONID=CFDB00B95AF1C731356A04B01FF369E3; mp_62107c6714e5356c33d43ef8d8f43cee_mixpanel=%7B%22distinct_id%22%3A%20%22fldf7517754d071b07cb0e77%22%2C%22%24device_id%22%3A%20%2216ab0cfc07a1b8-08fc4f883b46c5-454c062c-1fa400-16ab0cfc07b187%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%2C%22%24user_id%22%3A%20%22fldf7517754d071b07cb0e77%22%7D; intercom-session-no8pg948=emh3RjRGVzVmczQrTFdUaUZwWWliRTRBaDNlOEtmQ1VHcjh0NWl5eTZPNXVSdHdMU2VjMW9rRmt3WWZ0Q200Mi0tRitFT0Y1dkp6S2cvdkQ5OEFiR3N2Zz09--0f6b176d744b23f9b44bf693c5d9f429f84af84c; _gat_UA-60405455-1=1

如果我分离了cookie(就像我只发送jssionid一样,它就可以工作) 但需要发送完整的Cookie

If I separate the cookie (like if I send only jssionid it works) but need to send full cookie

需要系统税发送此Cookie

Need systax to send this cookie

推荐答案

您通常不需要设置cookie,因为空手道会在下一个请求中自动发送服务器返回的所有cookie.阅读文档: https://github.com/intuit/karate#configure -可以像这样在空手道中以正确的方式"设置多个Cookie: https://github.com/intuit/空手道#cookie

You typically never need to set cookies because Karate will automatically send any cookies returned by the server in the next request. Read the docs: https://github.com/intuit/karate#configure - and you can set multiple cookies the "right way" in Karate like this: https://github.com/intuit/karate#cookie

您在问题中张贴的内容似乎是由多个Cookie组成的整个标头.对于您要测试的服务器,最有可能只需要其中一个或两个即可.我建议您向拥有该服务的团队咨询.

What you have posted in your question seems to be the entire header made up of multiple cookies. It is most likely that you only need one or two of these for the server you are trying to test. I recommend you check with the team owning the service.

如果您知道自己在做什么,则可以像这样手动设置整个cookie标头-但由于上述原因而不建议使用-因为您将需要处理/编码特殊字符等-这很可能是您执行该操作的原因问题.

You can set the entire cookies header manually like this if you know what you are doing - but not recommended because of the above reason - and because you will need to handle / encode special characters etc - which is most likely why you ran into issues.

* header Cookie = '_ga=GA1.2.1041556506.1557744563; _gcl_au=1.1.139136457.1560512273; JabmoSP0id.ffef=d37c42bf-f223-43c6-a73c-fa502e23712d.1560512274.5.1561197329.1560589232.2561e1f4-79fe-4b63-88c6-157c6e8ed125; _gid=GA1.2.1289186220.1561356841;'

请注意,可以从这样的文本文件中读取上面的右侧:

Note that the right-hand side above can be read from a text file like this:

* header Cookie = read('huge-string.txt') 

这篇关于如何在空手道中设置大Cookie标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆