cURL on Windows

The environment I work in is ASP.NET, SQL Server, Active Directory, etc. We have the straight enterprisey Microsoft stack. And that works for us; it’s a well-established, well-supported way to build line of business applications. It’s easy to hire people who know the stack, it’s easy to explain the tech we’ll use to prospective clients, etc.

One of our clients recently hired another firm to build an iPhone app that interacts with our data. So we fired up a web API project, built the calls that should support the app, and went back to other work. The mobile developers found some small bugs in our API, so we had to test them out.

And that’s where I discovered an unexpected blessing of bash on Windows 10: You can just run straight shell scripts full of cURL calls without changing them.

curlAndVs

The mobile app developers had sent us some cURL scripts and said, “hey, these don’t bring back what we thought they would.” And I was able to just open up Notepad++, change the test server’s hostname to localhost:portwhatever with a find-all. Then I opened the web API project in Visual Studio, launched it, opened bash, and ran the cURL scripts. I was able to see what they saw.

It was pretty seamless. I’m not sure what I would’ve done before bash on Windows. I probably would have needed to hand-translate the cURL/bash files into something more Windows friendly, or at least copy-pasted lots of the data into Postman or something. And I would have always had the suspicion that whatever bugs I found doing that were a result of the translation process.

I think cURL is something of a lingua franca for demonstrating web APIs, at least in the Linux world. Being able to speak that language (and test internally in that language) is going to make the next web API much easier for us to build and test.

So there’s an unexpected happy use case for bash on Windows.

Till next time, happy learning!

-Will

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s