Skip to content

Commit

Permalink
google-api-go-client: fix missing Content-Type
Browse files Browse the repository at this point in the history
Breaking change made when adding Resumable media support here:
8ec38e5
caused Content-Type to not be filled in when the media was empty.
This change always sets the content type as it used to do.

All APIs have been updated.

Change-Id: If8429e471c9aaeac1f26f7cd1b4ec97c327f6200
Reviewed-on: https://code-review.googlesource.com/1880
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
gmlewis committed Jan 27, 2015
1 parent b3e6a82 commit 901b69e
Show file tree
Hide file tree
Showing 30 changed files with 92 additions and 481 deletions.
5 changes: 2 additions & 3 deletions admin/email_migration_v2/admin-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,9 @@ func (c *MailInsertCall) Do() error {
params.Set("uploadType", c.protocol_)
}
urls += "?" + params.Encode()
var hasMedia_ bool
if c.protocol_ != "resumable" {
var cancel func()
cancel, hasMedia_ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
cancel, _ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
if cancel != nil {
defer cancel()
}
Expand All @@ -205,7 +204,7 @@ func (c *MailInsertCall) Do() error {
if params.Get("name") == "" {
return fmt.Errorf("resumable uploads must set the Name parameter.")
}
} else if hasMedia_ {
} else {
req.Header.Set("Content-Type", ctype)
}
req.Header.Set("User-Agent", "google-api-go-client/0.5")
Expand Down
10 changes: 4 additions & 6 deletions analytics/v3/analytics-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -5673,10 +5673,9 @@ func (c *ManagementDailyUploadsUploadCall) Do() (*DailyUploadAppend, error) {
urls += "?" + params.Encode()
body = new(bytes.Buffer)
ctype := "application/json"
var hasMedia_ bool
if c.protocol_ != "resumable" {
var cancel func()
cancel, hasMedia_ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
cancel, _ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
if cancel != nil {
defer cancel()
}
Expand All @@ -5698,7 +5697,7 @@ func (c *ManagementDailyUploadsUploadCall) Do() (*DailyUploadAppend, error) {
if params.Get("name") == "" {
return nil, fmt.Errorf("resumable uploads must set the Name parameter.")
}
} else if hasMedia_ {
} else {
req.Header.Set("Content-Type", ctype)
}
req.Header.Set("User-Agent", "google-api-go-client/0.5")
Expand Down Expand Up @@ -10414,10 +10413,9 @@ func (c *ManagementUploadsUploadDataCall) Do() (*Upload, error) {
urls += "?" + params.Encode()
body = new(bytes.Buffer)
ctype := "application/json"
var hasMedia_ bool
if c.protocol_ != "resumable" {
var cancel func()
cancel, hasMedia_ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
cancel, _ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
if cancel != nil {
defer cancel()
}
Expand All @@ -10438,7 +10436,7 @@ func (c *ManagementUploadsUploadDataCall) Do() (*Upload, error) {
if params.Get("name") == "" {
return nil, fmt.Errorf("resumable uploads must set the Name parameter.")
}
} else if hasMedia_ {
} else {
req.Header.Set("Content-Type", ctype)
}
req.Header.Set("User-Agent", "google-api-go-client/0.5")
Expand Down
15 changes: 6 additions & 9 deletions androidpublisher/v2/androidpublisher-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -1817,10 +1817,9 @@ func (c *EditsApksUploadCall) Do() (*Apk, error) {
urls += "?" + params.Encode()
body = new(bytes.Buffer)
ctype := "application/json"
var hasMedia_ bool
if c.protocol_ != "resumable" {
var cancel func()
cancel, hasMedia_ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
cancel, _ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
if cancel != nil {
defer cancel()
}
Expand All @@ -1840,7 +1839,7 @@ func (c *EditsApksUploadCall) Do() (*Apk, error) {
if params.Get("name") == "" {
return nil, fmt.Errorf("resumable uploads must set the Name parameter.")
}
} else if hasMedia_ {
} else {
req.Header.Set("Content-Type", ctype)
}
req.Header.Set("User-Agent", "google-api-go-client/0.5")
Expand Down Expand Up @@ -2656,10 +2655,9 @@ func (c *EditsExpansionfilesUploadCall) Do() (*ExpansionFilesUploadResponse, err
urls += "?" + params.Encode()
body = new(bytes.Buffer)
ctype := "application/json"
var hasMedia_ bool
if c.protocol_ != "resumable" {
var cancel func()
cancel, hasMedia_ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
cancel, _ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
if cancel != nil {
defer cancel()
}
Expand All @@ -2681,7 +2679,7 @@ func (c *EditsExpansionfilesUploadCall) Do() (*ExpansionFilesUploadResponse, err
if params.Get("name") == "" {
return nil, fmt.Errorf("resumable uploads must set the Name parameter.")
}
} else if hasMedia_ {
} else {
req.Header.Set("Content-Type", ctype)
}
req.Header.Set("User-Agent", "google-api-go-client/0.5")
Expand Down Expand Up @@ -3248,10 +3246,9 @@ func (c *EditsImagesUploadCall) Do() (*ImagesUploadResponse, error) {
urls += "?" + params.Encode()
body = new(bytes.Buffer)
ctype := "application/json"
var hasMedia_ bool
if c.protocol_ != "resumable" {
var cancel func()
cancel, hasMedia_ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
cancel, _ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
if cancel != nil {
defer cancel()
}
Expand All @@ -3273,7 +3270,7 @@ func (c *EditsImagesUploadCall) Do() (*ImagesUploadResponse, error) {
if params.Get("name") == "" {
return nil, fmt.Errorf("resumable uploads must set the Name parameter.")
}
} else if hasMedia_ {
} else {
req.Header.Set("Content-Type", ctype)
}
req.Header.Set("User-Agent", "google-api-go-client/0.5")
Expand Down
13 changes: 1 addition & 12 deletions appsactivity/v1/appsactivity-api.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"kind": "discovery#restDescription",
"etag": "\"l66ggWbucbkBw9Lpos72oziyefE/0zYm3U9WhfJU7WORU2EWqKp-P40\"",
"etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/forNnhAfI3dddvWHUgiTD-7URCo\"",
"discoveryVersion": "v1",
"id": "appsactivity:v1",
"name": "appsactivity",
Expand Down Expand Up @@ -89,7 +89,6 @@
"id": "Activity",
"type": "object",
"description": "An Activity resource is a combined view of multiple events. An activity has a list of individual events and a combined view of the common fields among all events.",
"externalTypeName": "google.appsactivity.v1.Activity",
"properties": {
"combinedEvent": {
"$ref": "Event",
Expand All @@ -108,7 +107,6 @@
"id": "Event",
"type": "object",
"description": "Represents the changes associated with an action taken by a user.",
"externalTypeName": "google.appsactivity.v1.Event",
"properties": {
"additionalEventTypes": {
"type": "array",
Expand Down Expand Up @@ -211,7 +209,6 @@
"id": "ListActivitiesResponse",
"type": "object",
"description": "The response from the list request. Contains a list of activities and a token to retrieve the next page of results.",
"externalTypeName": "google.appsactivity.v1.ListActivitiesResponse",
"properties": {
"activities": {
"type": "array",
Expand All @@ -230,7 +227,6 @@
"id": "Move",
"type": "object",
"description": "Contains information about changes in an object's parents as a result of a move type event.",
"externalTypeName": "google.appsactivity.v1.Move",
"properties": {
"addedParents": {
"type": "array",
Expand All @@ -252,7 +248,6 @@
"id": "Parent",
"type": "object",
"description": "Contains information about a parent object. For example, a folder in Drive is a parent for all files within it.",
"externalTypeName": "google.appsactivity.v1.Parent",
"properties": {
"id": {
"type": "string",
Expand All @@ -272,7 +267,6 @@
"id": "Permission",
"type": "object",
"description": "Contains information about the permissions and type of access allowed with regards to a Google Drive object. This is a subset of the fields contained in a corresponding Drive Permissions object.",
"externalTypeName": "google.appsactivity.v1.Permission",
"properties": {
"name": {
"type": "string",
Expand Down Expand Up @@ -328,7 +322,6 @@
"id": "PermissionChange",
"type": "object",
"description": "Contains information about a Drive object's permissions that changed as a result of a permissionChange type event.",
"externalTypeName": "google.appsactivity.v1.PermissionChange",
"properties": {
"addedPermissions": {
"type": "array",
Expand All @@ -350,7 +343,6 @@
"id": "Photo",
"type": "object",
"description": "Photo information for a user.",
"externalTypeName": "google.appsactivity.v1.Photo",
"properties": {
"url": {
"type": "string",
Expand All @@ -362,7 +354,6 @@
"id": "Rename",
"type": "object",
"description": "Contains information about a renametype event.",
"externalTypeName": "google.appsactivity.v1.Rename",
"properties": {
"newTitle": {
"type": "string",
Expand All @@ -378,7 +369,6 @@
"id": "Target",
"type": "object",
"description": "Information about the object modified by the event.",
"externalTypeName": "google.appsactivity.v1.Target",
"properties": {
"id": {
"type": "string",
Expand All @@ -398,7 +388,6 @@
"id": "User",
"type": "object",
"description": "A representation of a user.",
"externalTypeName": "google.appsactivity.v1.User",
"properties": {
"name": {
"type": "string",
Expand Down
5 changes: 2 additions & 3 deletions bigquery/v2/bigquery-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2033,10 +2033,9 @@ func (c *JobsInsertCall) Do() (*Job, error) {
params.Set("uploadType", c.protocol_)
}
urls += "?" + params.Encode()
var hasMedia_ bool
if c.protocol_ != "resumable" {
var cancel func()
cancel, hasMedia_ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
cancel, _ = googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
if cancel != nil {
defer cancel()
}
Expand All @@ -2055,7 +2054,7 @@ func (c *JobsInsertCall) Do() (*Job, error) {
if params.Get("name") == "" {
return nil, fmt.Errorf("resumable uploads must set the Name parameter.")
}
} else if hasMedia_ {
} else {
req.Header.Set("Content-Type", ctype)
}
req.Header.Set("User-Agent", "google-api-go-client/0.5")
Expand Down
12 changes: 1 addition & 11 deletions container/v1beta1/container-api.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"kind": "discovery#restDescription",
"etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/SXN1CJBboRcuoJhIRmlw8WIpB8c\"",
"etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/AlGO7dz3sDTBKgLgnWPYGlYVP9g\"",
"discoveryVersion": "v1",
"id": "container:v1beta1",
"name": "container",
Expand Down Expand Up @@ -79,7 +79,6 @@
"Cluster": {
"id": "Cluster",
"type": "object",
"externalTypeName": "container.v1beta1.Cluster",
"properties": {
"clusterApiVersion": {
"type": "string",
Expand Down Expand Up @@ -164,7 +163,6 @@
"CreateClusterRequest": {
"id": "CreateClusterRequest",
"type": "object",
"externalTypeName": "container.v1beta1.CreateClusterRequest",
"properties": {
"cluster": {
"$ref": "Cluster",
Expand All @@ -175,7 +173,6 @@
"ListAggregatedClustersResponse": {
"id": "ListAggregatedClustersResponse",
"type": "object",
"externalTypeName": "container.v1beta1.ListAggregatedClustersResponse",
"properties": {
"clusters": {
"type": "array",
Expand All @@ -189,7 +186,6 @@
"ListAggregatedOperationsResponse": {
"id": "ListAggregatedOperationsResponse",
"type": "object",
"externalTypeName": "container.v1beta1.ListAggregatedOperationsResponse",
"properties": {
"operations": {
"type": "array",
Expand All @@ -203,7 +199,6 @@
"ListClustersResponse": {
"id": "ListClustersResponse",
"type": "object",
"externalTypeName": "container.v1beta1.ListClustersResponse",
"properties": {
"clusters": {
"type": "array",
Expand All @@ -217,7 +212,6 @@
"ListOperationsResponse": {
"id": "ListOperationsResponse",
"type": "object",
"externalTypeName": "container.v1beta1.ListOperationsResponse",
"properties": {
"operations": {
"type": "array",
Expand All @@ -231,7 +225,6 @@
"MasterAuth": {
"id": "MasterAuth",
"type": "object",
"externalTypeName": "container.v1beta1.MasterAuth",
"properties": {
"password": {
"type": "string",
Expand All @@ -246,7 +239,6 @@
"NodeConfig": {
"id": "NodeConfig",
"type": "object",
"externalTypeName": "container.v1beta1.NodeConfig",
"properties": {
"machineType": {
"type": "string",
Expand All @@ -269,7 +261,6 @@
"id": "Operation",
"type": "object",
"description": "Defines the operation resource. All fields are output only.",
"externalTypeName": "container.v1beta1.Operation",
"properties": {
"errorMessage": {
"type": "string",
Expand Down Expand Up @@ -327,7 +318,6 @@
"id": "ServiceAccount",
"type": "object",
"description": "A Compute Engine service account.",
"externalTypeName": "container.v1beta1.ServiceAccount",
"properties": {
"email": {
"type": "string",
Expand Down

0 comments on commit 901b69e

Please sign in to comment.