-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(service): support ErrorProduces (#197)
Automatic merge from submit-queue. feat(service): support ErrorProduces **What this PR does / why we need it**: Add `ErrorProduces` into `Definition`. `ErrorProduces` is used to generate data for error. If this field is empty, it stands for this field equals to Produces. In some cases, succeessful data and error data should be generated in different ways. e.g. An API returns a file (`Content-Type` is `application/java-archive`), but it may returns an error with `NotFound`. You can set `Definition` as: ```go Produces: []string{"application/java-archive"}, ErrorProduces: []string{"application/json"}, ``` If a file existing, the API returns a file with `Content-Type: application/java-archive`, and carries data by response body. If an error occurs, it returns an error json with `Content-Type: application/json`. **Which issue(s) this PR fixes** *(optional, close the issue(s) when PR gets merged)*: Fixes #169 **Special notes for your reviewer**: /cc @ddysher **Release note**: ```release-note NONE ``` <!-- Thanks for sending a pull request! Here are some tips: 1. https://github.com/caicloud/engineering/blob/master/docs/review_conventions.md <-- what is the review process looks like 2. https://github.com/caicloud/engineering/blob/master/docs/commit_conventions.md <-- how to structure your git commit 3. https://github.com/caicloud/engineering/blob/master/docs/caicloud_bot.md <-- how to work with caicloud bot Other tips from Kubernetes cmomunity: 1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/devel/pull-requests.md#the-pr-submit-process and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide 2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/devel/pull-requests.md#best-practices-for-faster-reviews 3. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/devel/pull-requests.md#write-release-notes-if-needed 4. If the PR is unfinished, see how to mark it: https://github.com/kubernetes/community/blob/master/contributors/devel/pull-requests.md#marking-unfinished-pull-requests -->
- Loading branch information
1 parent
f9ea845
commit 21dc908
Showing
6 changed files
with
214 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.