If you are developing an API or a SaaS-offering, the chances are you will eventually want to build out some form of HTTP client that consumers of your API can easily import and use in order to make their own lives easier.
There are quite a few examples of this in the wild - this site for example, uses the Stripe to process payments
and, instead of me crafting the exact JSON HTTP requests and ensuring the right headers are sent etc, I use an their
handy go-stripe
package which helps to offload some of the complexities of directly interfacing with their systems.
The reason that they do this is quite simple. They want me to be successful when developing applications on-top of their world-class payment processing system. As such, they want to make it as simple as heavenly possible for me to be successful.
Course Overview
This course is going to walk you through the process of building out a fairly light-weight http client offering in Go.
We’ll be covering the following topics:
- Instantiating our Client
- Abstracting API Endpoints
- Error Handling - defining custom errors.
- Functional Options Pattern - Giving our consumers full control.
- Testing our client
By the end of this course, you will be a pro at building out your own HTTP clients that help simplify the lives of your own customers.
Prerequisites
In terms of prerequisites for this course, I will be assuming the following:
- You should have a good handle of the Go syntax.
- You should understand the basics of HTTP