Here's an example of making an HTTP request with a custom HTML body in Go:
main.go1074 chars42 lines
In this example, we create an HTTP POST request to "http://example.com" with the HTML body "<html><body><h1>Hello, World!</h1></body></html>". We set the Content-Type header of the request to "text/html" so the server knows how to parse the request body. Finally, we use the default HTTP client to send the request and print the status code and response body.
gistlibby LogSnag