Skip to main content
CourseFlix

How to develop a productive HTTP client in Golang (Go)

9h 44m 29s
English
Paid

Have you ever called a REST API from your Go program? Did you implemented your own HTTP client or did you ended up using some of the thousand libraries out there? Do you know what your HTTP client is doing in the background? In this course we're starting from scratch! We're going to remember how a basic HTTP call looks like by digging into the request & response objects. We're going to write a basic HTTP client to perform HTTP requests and then use it in productive applications.

 What issues do we have? Can we scale our applications by following this approach? Of course not! 

That's why we're creating an HTTP client library that provides:

  • Fast, reliable and friction-free HTTP connections.

  • Support for all HTTP methods: GET, POST, PUT, DELETE, PATCH and more!

  • A Concurrency-Safe HTTP client that you can use without worrying about performance.

  • Content type management and optimization.

  • Mocking features out of the box.

  • A clean interface in case you want to unit test your code without relying on integration testing features.

  • A robust implementation so you won't need any external dependency whatsoever.

  • Completely customizable interface: timeouts, transport layer, custom HTTP client and lots of useful features.

  • A library that is PRODUCTION-READY!

If you're looking to integrate a 3rd party REST APIs in your code, you'll need to perform an HTTP call to it. Make sure you take a look at this course before even considering alternatives out there that will force you to use different dependencies for running, testing and extending your code! As Robert Pike says: "A little copying is much better than a little dependency". In this course we're not only getting rid of the dependencies but we're also getting rid of the copying. We're not using anything more than the Go's standard library to design & develop our own HTTP client.

This client will the baseline for all of the applications we're going to build later, making our business scale and grow as fast as we can Go.

About the Author: Udemy

Udemy thumbnail

Udemy is the largest open marketplace for online courses on the internet. Founded in 2010 by Eren Bali, Oktay Caglar, and Gagan Biyani and headquartered in San Francisco, the company went public on the Nasdaq in 2021 under the ticker UDMY. The platform hosts well over two hundred thousand courses across software development, IT and cloud, data science, design, business, marketing, and creative skills, taught by tens of thousands of independent instructors. Roughly seventy million learners use it worldwide, and the corporate arm — Udemy Business — supplies a curated subset of that catalog to enterprise customers.

Because Udemy is a marketplace rather than a single editorial publisher, the catalog is uneven by design. The strongest material lives in the long-form, project-based courses authored by working engineers — full-stack JavaScript, React, Node.js, Python data science, AWS, Docker and Kubernetes, mobile development with Flutter and React Native, and cloud certification preparation. The CourseFlix listing under this source is the slice of that catalog that has been mirrored here for offline-friendly viewing, organized by topic and updated as new releases land. Pricing on Udemy itself swings dramatically with the site's near-permanent sales, which is why the platform is best treated as a deep reference catalog: pick instructors with strong reviews and a track record of updating their material rather than buying on the headline price alone.

Watch Online 45 lessons

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 45 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing
0:00
/
#1: Introduction
All Course Lessons (45)
#Lesson TitleDurationAccess
1
Introduction Demo
01:35
2
Welcome!
02:51
3
The reason for this course
08:43
4
What we're going to build
03:15
5
How an HTTP call looks like
13:23
6
Connections and timeouts
08:32
7
Implementing a basic HTTP GET
06:20
8
Default problems
21:33
9
The reason for a new library
25:36
10
Introduction to Go modules
20:18
11
Go basics: Structs, functions, interfaces and methods.
16:05
12
Adding basic behavior
13:24
13
Defining custom & common headers
17:41
14
Dealing with the request body
13:22
15
Testing, testing and testing!
18:09
16
Be careful with code coverage
18:38
17
Dealing with timeouts
16:07
18
Allow timeout customization
16:28
19
Allow timeout disabling
09:05
20
Builder pattern applied
15:47
21
Refactoring our builder implementation
06:11
22
Making the client concurrent-safe
09:04
23
Using our custom response implementation
18:11
24
Creating our examples
13:16
25
Should we provide mocking features?
12:24
26
Defining the Mock struct
14:12
27
Adding the mock server
17:35
28
Responding from the mock server
13:03
29
Adding a default mock
17:20
30
How to flush every active mock
09:01
31
Improving mock body and keys
07:57
32
How to publish a Go module
08:02
33
How to use our Go module
09:27
34
Easily testing API calls with our library
18:43
35
Allowing custom HTTP client
09:31
36
Clean our public interface
14:02
37
Adding documentation to our code
08:40
38
Adding more examples
21:08
39
Allow user agent definition
07:56
40
Defining common constants
06:29
41
Releasing the first stable version!
07:44
42
Cleaning our mocking interface
19:05
43
Changing how we mock requests
23:19
44
Cleaning our mock server
07:15
45
What we have done
18:02
Unlock unlimited learning

Get instant access to all 44 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription

Course content

45 lessons · 9h 44m 29s
Show all 45 lessons
  1. 1 Introduction 01:35
  2. 2 Welcome! 02:51
  3. 3 The reason for this course 08:43
  4. 4 What we're going to build 03:15
  5. 5 How an HTTP call looks like 13:23
  6. 6 Connections and timeouts 08:32
  7. 7 Implementing a basic HTTP GET 06:20
  8. 8 Default problems 21:33
  9. 9 The reason for a new library 25:36
  10. 10 Introduction to Go modules 20:18
  11. 11 Go basics: Structs, functions, interfaces and methods. 16:05
  12. 12 Adding basic behavior 13:24
  13. 13 Defining custom & common headers 17:41
  14. 14 Dealing with the request body 13:22
  15. 15 Testing, testing and testing! 18:09
  16. 16 Be careful with code coverage 18:38
  17. 17 Dealing with timeouts 16:07
  18. 18 Allow timeout customization 16:28
  19. 19 Allow timeout disabling 09:05
  20. 20 Builder pattern applied 15:47
  21. 21 Refactoring our builder implementation 06:11
  22. 22 Making the client concurrent-safe 09:04
  23. 23 Using our custom response implementation 18:11
  24. 24 Creating our examples 13:16
  25. 25 Should we provide mocking features? 12:24
  26. 26 Defining the Mock struct 14:12
  27. 27 Adding the mock server 17:35
  28. 28 Responding from the mock server 13:03
  29. 29 Adding a default mock 17:20
  30. 30 How to flush every active mock 09:01
  31. 31 Improving mock body and keys 07:57
  32. 32 How to publish a Go module 08:02
  33. 33 How to use our Go module 09:27
  34. 34 Easily testing API calls with our library 18:43
  35. 35 Allowing custom HTTP client 09:31
  36. 36 Clean our public interface 14:02
  37. 37 Adding documentation to our code 08:40
  38. 38 Adding more examples 21:08
  39. 39 Allow user agent definition 07:56
  40. 40 Defining common constants 06:29
  41. 41 Releasing the first stable version! 07:44
  42. 42 Cleaning our mocking interface 19:05
  43. 43 Changing how we mock requests 23:19
  44. 44 Cleaning our mock server 07:15
  45. 45 What we have done 18:02

Related courses

  • Full Time Go Dev thumbnail

    Full Time Go Dev

    By: Full Time Go Dev
    Rocket Fuel you GO career with the Full Time Go Dev Mastery. These secret techniques will make everyone say "WOW" while you destroy any GO task with the.
    42 hours 44 minutes 36 seconds 3 / 5
  • Go in Practice, Second Edition thumbnail

    Go in Practice, Second Edition

    By: Matt Butcher, Matt Farina, Nathan Kozyra
    "Go in Practice: Second Edition" is a collection of recipes containing techniques and best practices for creating industrial-grade applications in Go.
  • Build SaaS apps in Go (2nd edition) thumbnail

    Build SaaS apps in Go (2nd edition)

    By: Dominic St-Pierre
    Learn how to build performant and maintainable API-first web server in Go. I put some emphasis and content regarding building a SaaS in Go. If you want to build
    4 hours 30 minutes 22 seconds

Frequently asked questions

What is How to develop a productive HTTP client in Golang (Go) about?
Have you ever called a REST API from your Go program? Did you implemented your own HTTP client or did you ended up using some of the thousand libraries out there? Do you know what your HTTP client is doing in the background? In this course…
Who teaches How to develop a productive HTTP client in Golang (Go)?
How to develop a productive HTTP client in Golang (Go) is taught by Udemy. You can find more courses by this instructor on the corresponding source page.
How long is How to develop a productive HTTP client in Golang (Go)?
How to develop a productive HTTP client in Golang (Go) contains 45 lessons with a total runtime of 9 hours 44 minutes. All lessons are available to watch online at your own pace.
Is How to develop a productive HTTP client in Golang (Go) free to watch?
How to develop a productive HTTP client in Golang (Go) is part of CourseFlix's premium catalog. A CourseFlix subscription unlocks the full video player; the course description, table of contents, and preview information are available to everyone.
Where can I watch How to develop a productive HTTP client in Golang (Go) online?
How to develop a productive HTTP client in Golang (Go) is available to watch online on CourseFlix at https://courseflix.net/course/how-to-develop-a-productive-http-client-in-golang-go. The page hosts every lesson with the integrated video player; no download is required.