googleapis / googleapis/gapic-showcase
large http payload issue
- Dominant language
- Go
- Stars
- 183
- Forks
- 55
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 8
Description
While trying the project, I made an http request with a large payload with post and got an error like
`{"error":{"code":400,"message":"error reading body params '*': proto: syntax error (line 2:12): invalid character '\\x00' in string","details":null,"Body":"","Header":null,"Errors":null}}%`
this line needs all bytes to unmarshall
https://github.com/googleapis/gapic-showcase/blob/8186605bbe3c9202b8313f692e279ab2c4faf156/util/genrest/goviewcreator.go#L128
after some debugging and reproducing bug on simple go server i've found out this, giving r.body directly to teereader wont be able to read all data.
https://github.com/googleapis/gapic-showcase/blob/8186605bbe3c9202b8313f692e279ab2c4faf156/util/genrest/goviewcreator.go#L121
red dots are null bytes \\x00
> TeeReader returns a Reader that writes to w what it reads from r. All reads from r performed through it are matched with corresponding writes to w. There is no internal buffering - the write must complete before the read completes. Any error encountered while writing is reported as a read error.
https://cs.opensource.google/go/go/+/go1.20.5:src/io/io.go;l=603
Contributor guide
Assessment
This issue has not been assessed yet.