Skip to content

Commit

Permalink
fix(all): use CheckResponse for media downloads (#773)
Browse files Browse the repository at this point in the history
If a method supports media downloads use CheckResponse. This method
provided extra context to errors if the api follow
https://google.aip.dev/193. The storage api will continue to use
CheckMediaResponse as it does not conform to the aip due to legacy
reasons.

Fixes: #752
  • Loading branch information
codyoss authored Dec 11, 2020
1 parent b4a3262 commit 39cbab0
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 21 deletions.
4 changes: 2 additions & 2 deletions adsense/v1.4/adsense-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion androidpublisher/v3/androidpublisher-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion chat/v1/chat-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dfareporting/v3.3/dfareporting-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dfareporting/v3.4/dfareporting-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion displayvideo/v1/displayvideo-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion doubleclicksearch/v2/doubleclicksearch-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions drive/v2/drive-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions drive/v3/drive-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion google-api-go-generator/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,11 @@ func (meth *Method) generateCode() {
pn(`gensupport.SetOptions(c.urlParams_, opts...)`)
pn(`res, err := c.doRequest("media")`)
pn("if err != nil { return nil, err }")
pn("if err := googleapi.CheckMediaResponse(res); err != nil {")
if meth.api.Name == "storage" {
pn("if err := googleapi.CheckMediaResponse(res); err != nil {")
} else {
pn("if err := googleapi.CheckResponse(res); err != nil {")
}
pn("res.Body.Close()")
pn("return nil, err")
pn("}")
Expand Down
2 changes: 1 addition & 1 deletion remotebuildexecution/v1/remotebuildexecution-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion youtube/v3/youtube-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion youtubereporting/v1/youtubereporting-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 39cbab0

Please sign in to comment.