I tried to check against: https://early-hints.fastlylabs.com
and want to get the 103 status code, or at least check if he is there, but 103 is of course not persistent and will be overwritten once the 200 was fired.
Is there a way of capturing the 103 code?
I tried this, but it just gave back the 200 (OK) code:
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
resp, err := http.Head("https://early-hints.fastlylabs.com/")
if err != nil {
log.Fatalln(err)
}
fmt.Println(resp.Status)
}
But it just returns:
200 OK
When I try:
package main
import (
"fmt"
"log"
"net/http"
"net/http/httputil"
)
func main() {
resp, err := http.Head("https://early-hints.fastlylabs.com/")
if err != nil {
log.Fatalln(err)
}
b, err := httputil.DumpResponse(resp, false)
if err != nil {
log.Fatalln(err)
}
fmt.Println(string(b))
}
I get a header like:
HTTP/2.0 200 OK
[...]
But never a Code 103 (EarlyHint).
Is there a way to get the 103
(if triggered) and store it before it turns into a 200
just like at cURL?
curl -X HEAD -I https://early-hints.fastlylabs.com/ 2>&1
HTTP/2 103
origin-trial: [#########]
link: </hinted.png>; rel=preload; as=image
HTTP/2 200
[...]
Here I see the 103 code, but I am not able to make golang (net/http) show it to me.
Maybe this function is missing, or just not possible yet, even tho they are defined here: http package - net/http - Go Packages
StatusEarlyHints = 103 // RFC 8297
I btw am on golang v1.19.1, so the very latest.