How to get Content-Length header without downloading the resource? #565
-
I'd need to prod a number of large files over HTTP to get their I see there's a way to do a HEAD request, however while curl works:
the following resty code returns nothing:
What am I missing here? Ah snap! How about this? 👇 Lines 116 to 118 in 313f419 |
Beta Was this translation helpful? Give feedback.
Answered by
jeevatkm
Oct 2, 2023
Replies: 2 comments
-
@jeevatkm Can you shed a light please? 🙃 |
Beta Was this translation helpful? Give feedback.
0 replies
-
@enricorotundo I'm sorry for the delay. You could do - client := resty.New()
rsp, err := client.R().EnableTrace().Head("https://gist.githubusercontent.com/enricorotundo/990f0ad01a50d08dfb580e4ad404870e/raw/aa6934257351a0da93f1e740c72f27128590cebc/foo_data.txt")
fmt.Println(err)
fmt.Println(rsp.Header().Get("Content-Length")) Output:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jeevatkm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@enricorotundo I'm sorry for the delay. You could do -
Output: