Skip to content

Commit 1619fd9

Browse files
committed
fix: #39 Raise exception if import status code is not 201
Signed-off-by: Laurent Broudoux <[email protected]>
1 parent 5a3612a commit 1619fd9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ It allows to launch tests or import API artifacts with minimal dependencies.
66
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/microcks/microcks-cli/build-verify.yml?logo=github&style=for-the-badge)](https://github.com/microcks/microcks-cli/actions)
77
[![Container](https://img.shields.io/badge/dynamic/json?color=blue&logo=docker&style=for-the-badge&label=Quay.io&query=tags[0].name&url=https://quay.io/api/v1/repository/microcks/microcks-cli/tag/?limit=10&page=1&onlyActiveTags=true)](https://quay.io/repository/microcks/microcks-cli?tab=tags)
88
[![License](https://img.shields.io/github/license/microcks/microcks-cli?style=for-the-badge&logo=apache)](https://www.apache.org/licenses/LICENSE-2.0)
9-
[![Project Chat](https://img.shields.io/badge/chat-on_zulip-pink.svg?color=ff69b4&style=for-the-badge&logo=zulip)](https://microcksio.zulipchat.com/)
9+
[![Project Chat](https://img.shields.io/badge/discord-microcks-pink.svg?color=7289da&style=for-the-badge&logo=discord)](https://microcks.io/discord-invite/)
1010

1111

1212
## Build Status

pkg/connectors/microcks_client.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package connectors
1818
import (
1919
"bytes"
2020
"encoding/json"
21+
"errors"
2122
"fmt"
2223
"io"
2324
"io/ioutil"
@@ -312,6 +313,11 @@ func (c *microcksClient) UploadArtifact(specificationFilePath string, mainArtifa
312313
panic(err.Error())
313314
}
314315

316+
// Raise exception if not created.
317+
if resp.StatusCode != 201 {
318+
return "", errors.New(string(respBody))
319+
}
320+
315321
return string(respBody), err
316322
}
317323

0 commit comments

Comments
 (0)