@@ -3,7 +3,6 @@ package bitbucket
3
3
import (
4
4
"encoding/json"
5
5
"fmt"
6
- "io"
7
6
"io/ioutil"
8
7
"net/url"
9
8
)
@@ -129,7 +128,7 @@ type BitbucketTrigerPipelineRequestBody struct {
129
128
} `json:"target"`
130
129
}
131
130
132
- func (p * Pipelines ) TriggerPipeline (po * PipelinesOptions , body * BitbucketTrigerPipelineRequestBody ) (string , error ) {
131
+ func (p * Pipelines ) TriggerPipeline (po * PipelinesOptions , body * BitbucketTrigerPipelineRequestBody ) (interface {} , error ) {
133
132
urlStr := p .c .requestUrl ("/repositories/%s/%s/pipelines/" , po .Owner , po .RepoSlug )
134
133
135
134
b , err := json .Marshal (body )
@@ -138,17 +137,10 @@ func (p *Pipelines) TriggerPipeline(po *PipelinesOptions, body *BitbucketTrigerP
138
137
}
139
138
data := string (b )
140
139
141
- p .c .execute ("POST" , urlStr , data )
142
- responseBody , err := p .c .executeRaw ("GET" , urlStr , "" )
140
+ responseBody , err := p .c .execute ("POST" , urlStr , data )
143
141
if err != nil {
144
142
return "failed to trigger bitbucket pipeline" , err
145
143
}
146
- defer responseBody .Close ()
147
144
148
- rawBody , err := io .ReadAll (responseBody )
149
- if err != nil {
150
- return "" , err
151
- }
152
-
153
- return string (rawBody ), nil
145
+ return responseBody , nil
154
146
}
0 commit comments