http.Get(url) responds in HTTP/1.1

I am calling an API to get a body:

resp, err := http.Get(url)


&{200 OK 200 HTTP/1.1 1 1 map[Content-Type:[application/json]

Is the HTTP/1.1 a result of using http:// OR how can I use HTTP/2 without using https://?

If you use the functions and methods that implicitely create a Request for you, it will always be HTTP/1.1, its hardcoded:

If you want something else, you need to craft the Request on your own I’d guess.

1 Like

For HTTP/2, use

1 Like

Thanks. But does http2 make any difference in speed?
And how do I use this?

To be honest, I didn’t have a chance to test it.
Why you want to use http 2?
If you want to improve the performance, I suggest you to use

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.