无法让cURL命令在Postman中工作

问题描述 投票:0回答:1

我无法让我的cURL命令在Postman中工作。我迷失了Expect标头的工作原理。删除expect标头时,我的cURL命令中断。我甚至不提供该标题的值?我从here中找到了cURL命令

这可以成功上传jar到Apache Flink:

curl -X POST -H "Expect:" -F "jarfile=@/home/myUserName/goDev/src/myProject.dev/flink-init/bin/target/flink-java-project-1.jar" http://localhost:9081/jars/upload

当我作为原始文本导入POSTMAN时,我得到:

{
"error": "Failed to upload the file."
}

enter image description here

enter image description here

http curl http-headers postman apache-flink
1个回答
1
投票

HTTP标头“Expect”指示服务器期望大量数据。服务器端的东西需要标头。用“100-continue”填充它。

关于文件上载,在Body选项卡上的PostMan中,将参数类型更改为“File”而不是“Text”。然后你应该能够选择你的文件。如果将鼠标悬停在“jarfile”键上,您应该会看到该选项。

我认为发生的事情是您的请求是发送文件路径的值而不是文件的内容。

© www.soinside.com 2019 - 2024. All rights reserved.