liveBook · Manning

Net/http package

The net/http package is Go’s standard-library package providing HTTP client and server implementations, requests, responses, and related functionality.

How 3 Manning books explain it

Learn Go with Pocket-Sized Projects

net/http is Go's standard-library package providing HTTP client and server implementations.

How it is used
Provides HTTP clients for an exchange-rate CLI and server routing for a game service.
How deep it goes
Works through client configuration, timeout testing, handlers, routing, and response status ordering.
Examples
Uses an exchange-rate request, a delayed test server, and a POST /games endpoint.
What you can do after
Apply net/http to configure a client, serve routes, and test HTTP behavior.

Read how Learn Go with Pocket-Sized Projects explains net/http package →

Go in Practice, Second Edition

net/http is Go's standard library package for HTTP clients and servers.

How it is used
Provides standard-library HTTP clients and servers, from simple requests and handlers to extensible web applications.
How deep it goes
Works through runnable GET and server examples, then describes request/client separation and configurable clients; server construction extends into routing and middleware.
Examples
Uses a localhost web server, a GET that reads a response body, a DELETE through the default client, and a timed custom client.
What you can do after
Build it from scratch as a small Go web server, and make GET or custom-client HTTP requests.

Read how Go in Practice, Second Edition explains net/http package →

Go by Example

The http package is Go's standard-library package providing HTTP client and server implementations and related types.

How it is used
Uses standard-library HTTP clients and servers to build responsive programs, services, request handlers, and tests.
How deep it goes
Explains client round trips and server handlers through APIs, execution flow, connection pooling, and response-writing order.
Examples
Uses concurrent request pipelines, NewRequest, NewRequestWithContext, Client.Do, status checks, handlers, and ResponseWriter.
What you can do after
Build it from scratch by sending HTTP requests, consuming responses, registering handlers, and serving clients.

Read how Go by Example explains net/http package →

Also covered in

What to know first

Related concepts

Questions about net/http package

What is net/http package?

The net/http package is Go’s standard-library package providing HTTP client and server implementations, requests, responses, and related functionality.

Which Manning books explain net/http package?

Learn Go with Pocket-Sized Projects, Go in Practice, Second Edition and Go by Example.

What should I know before learning net/http package?

Manning books that teach net/http package usually introduce HTTP, Go, HTTP status code and TCP first.

What is net/http package part of?

Net/http package is part of standard library. A standard library is a collection of reusable modules, types, functions, APIs, and other facilities distributed with a programming language implementation or platform.

What are the parts of net/http package?

Net/http package includes DetectContentType.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.