From the blog post, Golang: A Powerful Generic REST API Helper Function
The function built in that blog post is called MakeHTTPRequest
, in http_helper/http_helper.go - feel free to copy or paste it into your own project, and adapt as necessary!
(This repo itself is a work in progress - really all I need to do is find an API that actually works for the PUT POST and DELETE examples, the generic
function under question is still valid; I will update with full working examples in the coming days!)
Clone this repo:
git clone https://github.com/princefishthrower/golang-generic-http-helper-function.git
Run the GET, PUT, POST, and DELETE examples:
go run main.go
Enjoy the delicious HTTP powerful generic-y-goodness! 🎉😎