powershell - 如何将带有标头授权和表单的 curl POST 转换为 PowerShell v3.0
问题描述
我有以下 curl 命令,我想将其转换为 PowerShell(PowerShell v3.0):
curl -s -k -H 'Authorization: api_key 1234567890' -F upload_file=@"C:\path\to\file" -X POST "https://my.url.com/submit"
到目前为止我所拥有的:
$Body= @{ "upload_file" = "C:\path\to\file" };
$Headers = @{ "Authorization" = "api_key 1234567890" };
$Uri = "https://my.url.com/submit"
Invoke-WebRequest -Method Post -Uri $Uri -H $Headers -Body $Body
我认为表单参数是问题所在。
提前致谢。
解决方案
推荐阅读
- linux - Azure 不支持将 Linux VM 内核从 AWS 迁移到 Azure
- javascript - WebPack Only: Invariant Violation: ReactKonva 目前不支持文本组件。你的文字是:“”
- python - 如何解析多个文本文件并将所需的输出附加到单个文件中。(用于文档)
- python - 在python中读取多个json
- python - Plotly 袖扣钥匙
- osmnx - OSMnx SSLError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443):
- scala - 从pyspark中的文本文件中删除第一行和最后一行
- vaticle-typedb - grakn.ai 中的属性实例应该是单例的吗?
- excel - 运行时错误:范围自动筛选上的“1004”
- javascript - 使用 For 循环时图像未正确对齐