当发出红色POST请求时,如何在标题中使用变量
我正试图用红色语言发出发帖请求 我必须传递一个带有授权的头,在发出请求并将其保存在变量当发出红色POST请求时,如何在标题中使用变量,post,rebol,red,Post,Rebol,Red,我正试图用红色语言发出发帖请求 我必须传递一个带有授权的头,在发出请求并将其保存在变量auth string中之前,我要计算授权字符串的值 probe精细打印auth字符串值 如果我在headers部分硬编码授权字符串,它会工作,但是当我尝试使用变量时,程序会退出 此代码带有硬编码的授权:“基本c29tZX…工作: username: "someusernamestring" password: "somepasswordstring" url: to url! rejoin ["https:
auth string
中之前,我要计算授权字符串的值
probe
精细打印auth字符串
值
如果我在headers部分硬编码授权字符串,它会工作,但是当我尝试使用变量时,程序会退出
此代码带有硬编码的授权:“基本c29tZX…
工作:
username: "someusernamestring"
password: "somepasswordstring"
url: to url! rejoin ["https://example.com/" username "/Account.json"]
auth-string: rejoin ["Basic " enbase/base rejoin [username ":" password] 64]
probe auth-string
response: write url [
post [
Content-Type: "application/x-www-form-urlencoded"
Authorization: "Basic c29tZXVzZXJuYW1lc3RyaW5nOnNvbWVwYXNzd29yZHN0cmluZw=="
]
{}
]
print response
但是,这段代码,带有变量
Authorization:auth string
不起作用,程序退出,我看不到任何错误
username: "someusernamestring"
password: "somepasswordstring"
url: to url! rejoin ["https://example.com/" username "/Account.json"]
auth-string: rejoin ["Basic " enbase/base rejoin [username ":" password] 64]
probe auth-string
response: write url [
post [
Content-Type: "application/x-www-form-urlencoded"
Authorization: auth-string
]
{}
]
print response
如何在headers部分中使用变量?这应该像在Rebol中一样工作
response: write url compose/deep [
post [
Content-Type: "application/x-www-form-urlencoded"
Authorization: (auth-string)
]
{}
]