The purpose of io.Copy(ioutil.Discard, r)
in render.DecodeJSON
#871
-
In the function io.Copy(ioutil.Discard, r) what is the purpose of that? |
Beta Was this translation helpful? Give feedback.
Answered by
VojtechVitek
Nov 2, 2023
Replies: 1 comment 1 reply
-
This is the reason: go-chi/render#42
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
haarts
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the reason: go-chi/render#42
json.NewDecoder(r).Decode(v)
reads the first JSON object only and leaves the rest of the bytes unread in the reader.