When Curl isn't Curl
Curl in PowerShell and Curl elsewhere are not the same thing.
Published: July 7, 2019
Working through the Getting Started guide for Event Store.
Running this in PowerShell 5.1:
curl -i -d "@event.json" "http://127.0.0.1:2113/streams/newstream" -H "Content-Type:application/vnd.eventstore.events+json"
Invoke-WebRequest : Missing an argument for parameter 'InFile'. Specify a parameter of type 'System.String' and try again.
But why? Curl is set up properly (it’s not telling me
curl : The term 'curl' is not recognized . . .)
curl in PowerShell does not use Curl (even if Curl is installed, added to your PATH and so on). Instead,
curl is an alias of
Invoke-WebRequest. This means that if you run
curl in PowerShell with options that aren’t supported by
Invoke-WebRequest, you get the error above.
There are two options:
The StackOverflow answer linked above suggests removing
curl as an alias:
I decided I didn’t want to mess with PowerShell’s commands and aliases, so I used Git Bash to run my Curl commands instead.