0

I am unable to get my cURL command to work in Postman. I am lost on how the Expect header works. My cURL command breaks when I remove the expect header. I am not even supplying a value for that header? I figured out the cURL command from here

This works and successfully uploads the jar to 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

When I import as raw text into POSTMAN I get:

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

enter image description here

enter image description here

smuggledPancakes
  • 9,881
  • 20
  • 74
  • 113

1 Answers1

1

The HTTP Header "Expect" indicates to the server to expect a large amount of data. Something on the server side is requiring that header. Populate it with "100-continue".

Regarding the file upload, in PostMan on the Body tab change the parameter type to "File" instead of "Text". Then you should able to select your file. If you hover your mouse over the key "jarfile" you should see the option appear.

I think what is happening is your request is sending the value of the file path instead of the contents of the file.

Bret Lipscomb
  • 480
  • 2
  • 7
  • It worked after I changed the parameter in the body to file. I did not even have to add a value to the Expect header. I like the idea of having a value though and it works with 100-continue. – smuggledPancakes May 07 '18 at 18:55