当用户使用 NSIS 脚本安装/卸载程序时,我需要进行 POST API 调用,但我不知道如何使用由 AppId 和 AppKey 两个键组成的标头来实现此目的。这是我的脚本代码:
inetc::post "" "http://localhost:3000/api/uninstallations"
此链接https://nsis.sourceforge.io/Inetc_plug-in指示我可以添加像 \HEADER "header: value" 这样的标头,但我需要向标头添加两个键值对。有办法解决这个问题吗?
标头字符串原封不动地传递到 WinINet,只需在每个之间添加 CR/LF 对:
Section
#https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending?sort=dont-sort
InitPluginsDir
inetc::get /header 'AppId: Acme App$\r$\nAppKey: 1234' "https://myhttpheader.com/" "$pluginsdir\tmp.htm" /END
Pop $1
DetailPrint $1
ExecShell "" "$pluginsdir\tmp.htm"
SectionEnd