Skip to content

Commit f417be7

Browse files
fix: fix for empty request bodies
1 parent ebf32ec commit f417be7

File tree

8 files changed

+18
-15
lines changed

8 files changed

+18
-15
lines changed

pkg/cmd/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ func handleBuildsRetrieve(ctx context.Context, cmd *cli.Command) error {
378378
cmd,
379379
apiquery.NestedQueryFormatBrackets,
380380
apiquery.ArrayQueryFormatComma,
381-
ApplicationJSON,
381+
EmptyBody,
382382
)
383383
if err != nil {
384384
return err
@@ -410,7 +410,7 @@ func handleBuildsList(ctx context.Context, cmd *cli.Command) error {
410410
cmd,
411411
apiquery.NestedQueryFormatBrackets,
412412
apiquery.ArrayQueryFormatComma,
413-
ApplicationJSON,
413+
EmptyBody,
414414
)
415415
if err != nil {
416416
return err

pkg/cmd/builddiagnostic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func handleBuildsDiagnosticsList(ctx context.Context, cmd *cli.Command) error {
6767
cmd,
6868
apiquery.NestedQueryFormatBrackets,
6969
apiquery.ArrayQueryFormatComma,
70-
ApplicationJSON,
70+
EmptyBody,
7171
)
7272
if err != nil {
7373
return err

pkg/cmd/buildtargetoutput.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func handleBuildsTargetOutputsRetrieve(ctx context.Context, cmd *cli.Command) er
7171
cmd,
7272
apiquery.NestedQueryFormatBrackets,
7373
apiquery.ArrayQueryFormatComma,
74-
ApplicationJSON,
74+
EmptyBody,
7575
)
7676
if err != nil {
7777
return err

pkg/cmd/flagoptions.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import (
2121
type BodyContentType int
2222

2323
const (
24-
MultipartFormEncoded BodyContentType = iota
24+
EmptyBody BodyContentType = iota
25+
MultipartFormEncoded
2526
ApplicationJSON
2627
)
2728

@@ -102,6 +103,8 @@ func flagOptions(
102103
}
103104

104105
switch bodyType {
106+
case EmptyBody:
107+
break
105108
case MultipartFormEncoded:
106109
buf := new(bytes.Buffer)
107110
writer := multipart.NewWriter(buf)

pkg/cmd/org.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func handleOrgsRetrieve(ctx context.Context, cmd *cli.Command) error {
5151
cmd,
5252
apiquery.NestedQueryFormatBrackets,
5353
apiquery.ArrayQueryFormatComma,
54-
ApplicationJSON,
54+
EmptyBody,
5555
)
5656
if err != nil {
5757
return err
@@ -81,7 +81,7 @@ func handleOrgsList(ctx context.Context, cmd *cli.Command) error {
8181
cmd,
8282
apiquery.NestedQueryFormatBrackets,
8383
apiquery.ArrayQueryFormatComma,
84-
ApplicationJSON,
84+
EmptyBody,
8585
)
8686
if err != nil {
8787
return err

pkg/cmd/project.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func handleProjectsRetrieve(ctx context.Context, cmd *cli.Command) error {
144144
cmd,
145145
apiquery.NestedQueryFormatBrackets,
146146
apiquery.ArrayQueryFormatComma,
147-
ApplicationJSON,
147+
EmptyBody,
148148
)
149149
if err != nil {
150150
return err
@@ -208,7 +208,7 @@ func handleProjectsList(ctx context.Context, cmd *cli.Command) error {
208208
cmd,
209209
apiquery.NestedQueryFormatBrackets,
210210
apiquery.ArrayQueryFormatComma,
211-
ApplicationJSON,
211+
EmptyBody,
212212
)
213213
if err != nil {
214214
return err

pkg/cmd/projectbranch.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func handleProjectsBranchesRetrieve(ctx context.Context, cmd *cli.Command) error
174174
cmd,
175175
apiquery.NestedQueryFormatBrackets,
176176
apiquery.ArrayQueryFormatComma,
177-
ApplicationJSON,
177+
EmptyBody,
178178
)
179179
if err != nil {
180180
return err
@@ -211,7 +211,7 @@ func handleProjectsBranchesList(ctx context.Context, cmd *cli.Command) error {
211211
cmd,
212212
apiquery.NestedQueryFormatBrackets,
213213
apiquery.ArrayQueryFormatComma,
214-
ApplicationJSON,
214+
EmptyBody,
215215
)
216216
if err != nil {
217217
return err
@@ -259,7 +259,7 @@ func handleProjectsBranchesDelete(ctx context.Context, cmd *cli.Command) error {
259259
cmd,
260260
apiquery.NestedQueryFormatBrackets,
261261
apiquery.ArrayQueryFormatComma,
262-
ApplicationJSON,
262+
EmptyBody,
263263
)
264264
if err != nil {
265265
return err
@@ -299,7 +299,7 @@ func handleProjectsBranchesRebase(ctx context.Context, cmd *cli.Command) error {
299299
cmd,
300300
apiquery.NestedQueryFormatBrackets,
301301
apiquery.ArrayQueryFormatComma,
302-
ApplicationJSON,
302+
EmptyBody,
303303
)
304304
if err != nil {
305305
return err
@@ -339,7 +339,7 @@ func handleProjectsBranchesReset(ctx context.Context, cmd *cli.Command) error {
339339
cmd,
340340
apiquery.NestedQueryFormatBrackets,
341341
apiquery.ArrayQueryFormatComma,
342-
ApplicationJSON,
342+
EmptyBody,
343343
)
344344
if err != nil {
345345
return err

pkg/cmd/projectconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func handleProjectsConfigsRetrieve(ctx context.Context, cmd *cli.Command) error
7171
cmd,
7272
apiquery.NestedQueryFormatBrackets,
7373
apiquery.ArrayQueryFormatComma,
74-
ApplicationJSON,
74+
EmptyBody,
7575
)
7676
if err != nil {
7777
return err

0 commit comments

Comments
 (0)