How do I pass a URL a cookie using Rebol 3?

我只是一个虾纸丫 提交于 2019-12-05 11:09:01

Your try is almost there. You use WRITE with a small "HTTP dialect" in an argument block whenever you need to configure something about the HTTP request being sent. First item of that dialect is the HTTP method to use, second item (if present) is a block of HTTP headers to send along.

If I understand your example correctly, you want to send a cookie with "USER_LOCALE=fr_FR" as payload. So you'd do:

write page [GET [Cookie: {USER_LOCALE=fr_FR}]]

Let's test this against a httpbin:

>> print to-string write http://httpbin.org/headers [GET [Cookie: "USER_LOCALE=fr_FR"]]     
{
  "headers": {
    "Accept": "*/*", 
    "Accept-Charset": "utf-8", 
    "Cookie": "USER_LOCALE=fr_FR", 
    "Host": "httpbin.org", 
    "User-Agent": "REBOL"
  }
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!