[
https://issues.apache.org/jira/browse/SCB-622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16494683#comment-16494683
]
ASF GitHub Bot commented on SCB-622:
------------------------------------
little-cui closed pull request #360: SCB-622 Compatible with old version
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/360
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/server/rest/controller/v4/microservice_controller.go
b/server/rest/controller/v4/microservice_controller.go
index 5efe78a7..ce578c76 100644
--- a/server/rest/controller/v4/microservice_controller.go
+++ b/server/rest/controller/v4/microservice_controller.go
@@ -26,9 +26,10 @@ import (
"github.com/apache/incubator-servicecomb-service-center/server/rest/controller"
"io/ioutil"
"net/http"
- "strings"
)
+var trueOrFalse = map[string]bool{"true": true, "false": false, "1": true,
"0": false}
+
type MicroServiceService struct {
//
}
@@ -86,15 +87,18 @@ func (this *MicroServiceService) Update(w
http.ResponseWriter, r *http.Request)
}
func (this *MicroServiceService) Unregister(w http.ResponseWriter, r
*http.Request) {
- force := r.URL.Query().Get("force")
serviceId := r.URL.Query().Get(":serviceId")
- if force != "false" && force != "true" && strings.TrimSpace(force) !=
"" {
+ force := r.URL.Query().Get("force")
+
+ b, ok := trueOrFalse[force]
+ if force != "" && !ok {
controller.WriteError(w, scerr.ErrInvalidParams, "parameter
force must be false or true")
return
}
+
request := &pb.DeleteServiceRequest{
ServiceId: serviceId,
- Force: force == "true",
+ Force: b,
}
resp, _ := core.ServiceAPI.Delete(r.Context(), request)
controller.WriteResponse(w, resp.Response, nil)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Change the type of query parameter 'force' to bool in Delete service API
> ------------------------------------------------------------------------
>
> Key: SCB-622
> URL: https://issues.apache.org/jira/browse/SCB-622
> Project: Apache ServiceComb
> Issue Type: Improvement
> Components: Service-Center
> Reporter: little-cui
> Assignee: little-cui
> Priority: Major
> Fix For: service-center-1.0.0-m2
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)