2
我正在向URL发送HTTP POST请求。它会在响应的location
标题中发回我需要的一条信息。我如何获得该标题?我试着下面的代码,它似乎并没有工作:KRL:从http:post()获取“位置”标题()
在使用该http:post()
行动规则的动作块:
http:post("https://cas.byu.edu/cas/v1/tickets/")
with params = {"username": netid, "password": password}
and autoraise = "gottgt"
and response_headers = ["location"];
规则处理该事件http
:
rule got_tgt {
select when http post label "gottgt"
pre {
content = event:param("content");
location = event:param("location");
}
{
notify("CAS Login", "Got back the POST response (#{location}): #{content}") with sticky=true;
}
}
但是,location
变量始终为空。我如何告诉KRL我需要location
标题,以及如何从响应中获取它?
谢谢!提高明确的事件表明信息在那里。如果我无法弄清楚如何以通常的方式做到这一点,我会这么做。 – 2011-06-14 22:49:24
+1使用httpbin.org – 2011-06-14 23:17:29
但我的雅赫达月亮参考没有额外的积分?认真。 – TelegramSam 2011-06-16 15:53:34