Overview multipart/form-data content-type can be used to send the pdf files in an HTTP POST call. The form-data will contain pdf filename- test.pdf in the example that we will see in this…
Tag: go
HTTP send/receive jpeg file in request body example in Go (Golang)
Overview multipart/form-data content-type can be used to send the jpeg files in an HTTP POST call. The form-data will contain jpeg filename- test.jpeg in the example that we will see in this…
HTTP client or Send x-www-form-urlencoded request body in Go (Golang)
Overview The applcation/x-www-form-urlencoded content-type request body is like a giant query string. Similar to the query string in a URI it is a key-value pair having the below format. where there are…
HTTP server or Parse incoming application/x-www-form-urlencoded request body in Go (Golang)
Note: This post is parsing the application/x-www-form-urlencoded request at the server end. If you using an HTTP client and trying to send the application/x-www-form-urlencoded request then please see the below link https://golangbyexample.com/http-client-urlencoded-body-go/…
HTTP Client/Server with Basic Auth in Go (Golang)
Overview Basic auth is the simplest form of providing access controls for resources on web server. Basic Access Authentication is a way of providing user name and password to the server while…
Get client’s user agent from an incoming HTTP request in Go (Golang)
Overview User-agent in an incoming HTTP request is present in the headers of the request. In Go an incoming HTTP request is represented by the http.Request struct https://golang.org/src/net/http/request.go The http.Request struct exposes…
Set request headers for an outgoing HTTP request in Go (Golang)
Note: Related Post Get headers from an incoming HTTP request in Go – https://golangbyexample.com/headers-http-request-golang/ Set response headers for an incoming HTTP request in Go (Golang) – https://golangbyexample.com/set-resposne-headers-http-go/ Get response headers for an outgoing HTTP…
Set response headers for an incoming HTTP request in Go (Golang)
Note: Related Post Get headers from an incoming HTTP request in Go – https://golangbyexample.com/headers-http-request-golang/ Get response headers for an outgoing HTTP request in Golang- https://golangbyexample.com/get-response-headers-making-go/ Set headers for an outgoing HTTP request…
Get JSON request body from a HTTP request in Go (Golang)
Overview json/encoding package contains methods that can be used to convert a request body of an incoming HTTP request into a golang struct. Before we start just a word about the request…
Decorator design pattern in Go (Golang)
Overview Decorator design pattern is a structural design pattern. It lets you provide additional functionality or decorates an object without altering that object. It is better understood with an example. Imagine you…