1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-11-06 09:09:19 +02:00

Abap relese confirm fault tollerant (#3916)

* no error if package release fails
This commit is contained in:
tiloKo
2022-08-23 15:33:42 +02:00
committed by GitHub
parent f089e3d89e
commit 0a2327dda8
6 changed files with 109 additions and 12 deletions

View File

@@ -322,12 +322,13 @@ type AbapBinding struct {
// ClientMock contains information about the client mock
type ClientMock struct {
Token string
Body string
BodyList []string
StatusCode int
Error error
NilResponse bool
Token string
Body string
BodyList []string
StatusCode int
Error error
NilResponse bool
ErrorInsteadOfDump bool
}
// SetOptions sets clientOptions for a client mock
@@ -344,6 +345,9 @@ func (c *ClientMock) SendRequest(method, url string, bdy io.Reader, hdr http.Hea
if c.Body != "" {
body = []byte(c.Body)
} else {
if c.ErrorInsteadOfDump && len(c.BodyList) == 0 {
return nil, errors.New("No more bodies in the list")
}
bodyString := c.BodyList[len(c.BodyList)-1]
c.BodyList = c.BodyList[:len(c.BodyList)-1]
body = []byte(bodyString)