Overview Base64 is also known as Base64 Content-Transfer-Encoding. Base64 is the encoding of binary data into ASCII text. But it uses only 64 characters and plus one padding character which are present…
Author: admin
Conversion between struct and JSON in Go (Golang)
Overview encoding/json package provides utilities that can be used to convert to and from JSON. The same utility can be used to convert a golang struct to a JSON string and vice…
Convert an array/slice into a JSON in Go (Golang)
Overview encoding/json package provides the Marshal function which can be used to convert a golang array or slice into a JSON string and vice versa. Let’s see an example Example Output
Convert a JSON to map in Go (Golang)
Overview encoding/json package provides utilities that can be used to convert to and from JSON. The same utility can be used to convert a golang map to JSON string and vice versa….
Convert a map to JSON in Go (Golang)
Overview encoding/json package provides utilities that can be used to convert to and from JSON. The same utility can be used to convert a golang map to JSON string and vice versa….
Conversion between map and JSON in Go (Golang)
Overview encoding/json package provides utilities that can be used to convert to and from JSON. The same utility can be used to convert a golang map to JSON string and vice versa….
Why response body is closed in golang
The response body should be closed after the response is fully read. This is done to prevent resource leak of connections. If the response body is not closed then the connection will…
HTTP send/receive application octet-stream request body in Go (Golang)
Overview application/octet-stream content-type is used to transfer binary data in the HTTP request body. So application/octet-stream is used for sending files over HTTP request. Let’s see an example of both HTTP client and server…
HTTP client/server multipart form-data request body example in Go (Golang)
Overview In HTTP context, the multipart/form-data content-type is used for submitting HTML form. In the case of multipart/form-data, as the name suggests, the body consists of different parts separated by a delimiter…
HTTP send/receive png file in request body example in Go (Golang)
Overview multipart/form-data content-type can be used to send the png files in an HTTP POST call. The form-data will contain png filename- test.png in the example that we will see in this…