-1

Is there any way to add headers and data to an HTTP request in Golang, as well as URL parameters? I have tried to add data to a POST request, but it seems Golang just isn't meant for sending any kind of complex request. After much research online I'm not sure if there's a way, but if anyone knows how, please tell me!

  • Yes you can do those things. It's a bit hard to help without your code buty I assume you are using a `http.Request`. So eg to add a header use `request.Header().Add()`. – AJR Aug 21 '21 at 05:08
  • 2
    Does this answer your question? [How to translate this curl call into Go?](https://stackoverflow.com/questions/68684593/how-to-translate-this-curl-call-into-go) – nipuna Aug 21 '21 at 05:41

1 Answers1

0

Yes, you can. See How to set headers in http get request?, it answers your question. Also, you can find more information about the default http package in https://pkg.go.dev/net/http.

Vitor Vidal
  • 116
  • 1
  • 4