Is it possible to read big xml/stream request partly using gin/fasthttp webserver

197 views
Skip to first unread message

desaia...@gmail.com

unread,
Dec 29, 2018, 2:22:30 AM12/29/18
to golang-nuts

Is there any way to read stream of big request as or when web server receives it partly rather than ioutil.ReadAll(c.Request.Body) or GetRawData of Gin server

Please help

Thanks,

Abhijit

Tamás Gulácsi

unread,
Dec 29, 2018, 4:54:54 AM12/29/18
to golang-nuts
Yes, use xml.NewDecoder(r.Br.Body)

desaia...@gmail.com

unread,
Dec 29, 2018, 6:09:56 AM12/29/18
to golang-nuts

Not xml decoder... I mean want to capture stream chunk/parts when part data arrived at web server
Don't want to wait to receive entire file/request and then process rather want to process whatever comes in

Thanks for the reply

On Saturday, December 29, 2018 at 3:24:54 PM UTC+5:30, Tamás Gulácsi wrote:
Yes, use xml.NewDecoder(r.Br.Body)

Tamás Gulácsi

unread,
Dec 29, 2018, 10:23:46 AM12/29/18
to golang-nuts
resp.Body is already an io.Reader, sou you can read it in chunks as you wish.

desaia...@gmail.com

unread,
Dec 29, 2018, 11:11:38 PM12/29/18
to golang-nuts
This will then work for me

Thanks very much Tamas
Reply all
Reply to author
Forward
0 new messages