Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当发出红色POST请求时,如何在标题中使用变量_Post_Rebol_Red - Fatal编程技术网

当发出红色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)
    ]
    {}    
]