You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/12/30 14:37:09 UTC

[GitHub] [apisix-dashboard] liuxiran opened a new pull request #1166: fix: update validation and msg

liuxiran opened a new pull request #1166:
URL: https://github.com/apache/apisix-dashboard/pull/1166


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [ ] Bugfix
   
   - Related issues
   last part of #1077 
   
   
   ___
   ### New feature or improvement
   - Describe the details and related test reports.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1166: fix: update online debug api protocol validation and error msg

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1166:
URL: https://github.com/apache/apisix-dashboard/pull/1166#issuecomment-752645753


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=h1) Report
   > Merging [#1166](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=desc) (3044f50) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/45d79b674c2f500d76b76939674b6792201a70bb?el=desc) (45d79b6) will **increase** coverage by `0.01%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1166/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1166      +/-   ##
   ==========================================
   + Coverage   42.30%   42.32%   +0.01%     
   ==========================================
     Files          31       31              
     Lines        1924     1928       +4     
   ==========================================
   + Hits          814      816       +2     
   - Misses       1000     1001       +1     
   - Partials      110      111       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/handler/global\_rule/global\_rule.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1166/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZ2xvYmFsX3J1bGUvZ2xvYmFsX3J1bGUuZ28=) | `61.40% <0.00%> (-0.87%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=footer). Last update [45d79b6...3044f50](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #1166: fix: update online debug api protocol validation and error msg

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1166:
URL: https://github.com/apache/apisix-dashboard/pull/1166#discussion_r550258339



##########
File path: api/internal/handler/route_online_debug/route_online_debug.go
##########
@@ -80,7 +81,8 @@ func DebugRequestForwarding(c droplet.Context) (interface{}, error) {
 	if v, ok := protocolMap[requestProtocol]; ok {
 		return v.RequestForwarding(c)
 	} else {
-		return &data.SpecCodeResponse{StatusCode: http.StatusBadRequest}, fmt.Errorf("protocol unspported %s", paramsInput.RequestProtocol)
+		return &data.SpecCodeResponse{StatusCode: http.StatusBadRequest},
+			fmt.Errorf("protocol unspported %s, need http or https. but given %s", paramsInput.RequestProtocol, paramsInput.RequestProtocol)

Review comment:
       ```suggestion
   			fmt.Errorf("Protocol unsupported %s, only http or https is allowed, but given %s", paramsInput.RequestProtocol, paramsInput.RequestProtocol)
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io commented on pull request #1166: fix: update online debug api protocol validation and error msg

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #1166:
URL: https://github.com/apache/apisix-dashboard/pull/1166#issuecomment-752645753


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=h1) Report
   > Merging [#1166](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=desc) (43c9e23) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/45d79b674c2f500d76b76939674b6792201a70bb?el=desc) (45d79b6) will **decrease** coverage by `0.05%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1166/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1166      +/-   ##
   ==========================================
   - Coverage   42.30%   42.25%   -0.06%     
   ==========================================
     Files          31       31              
     Lines        1924     1924              
   ==========================================
   - Hits          814      813       -1     
   - Misses       1000     1001       +1     
     Partials      110      110              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1166/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `79.37% <0.00%> (-0.63%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=footer). Last update [45d79b6...43c9e23](https://codecov.io/gh/apache/apisix-dashboard/pull/1166?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1166: fix: update online debug api protocol validation and error msg

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1166:
URL: https://github.com/apache/apisix-dashboard/pull/1166#discussion_r550387456



##########
File path: api/internal/handler/route_online_debug/route_online_debug.go
##########
@@ -49,6 +49,7 @@ var protocolMap map[string]ProtocolSupport
 func init() {
 	protocolMap = make(map[string]ProtocolSupport)
 	protocolMap["http"] = &HTTPProtocolSupport{}
+	protocolMap["https"] = &HTTPProtocolSupport{}
 }

Review comment:
       > you could refer to:
   > https://github.com/uber-go/guide/blob/master/style.md#avoid-init
   
   thanks, updating~
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1166: fix: update online debug api protocol validation and error msg

Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1166:
URL: https://github.com/apache/apisix-dashboard/pull/1166#discussion_r550374274



##########
File path: api/internal/handler/route_online_debug/route_online_debug.go
##########
@@ -80,7 +81,8 @@ func DebugRequestForwarding(c droplet.Context) (interface{}, error) {
 	if v, ok := protocolMap[requestProtocol]; ok {
 		return v.RequestForwarding(c)
 	} else {
-		return &data.SpecCodeResponse{StatusCode: http.StatusBadRequest}, fmt.Errorf("protocol unspported %s", paramsInput.RequestProtocol)
+		return &data.SpecCodeResponse{StatusCode: http.StatusBadRequest},
+			fmt.Errorf("protocol unspported %s, need http or https. but given %s", paramsInput.RequestProtocol, paramsInput.RequestProtocol)

Review comment:
       many thanks~




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #1166: fix: update online debug api protocol validation and error msg

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1166:
URL: https://github.com/apache/apisix-dashboard/pull/1166#discussion_r550258195



##########
File path: api/internal/handler/route_online_debug/route_online_debug.go
##########
@@ -80,7 +81,8 @@ func DebugRequestForwarding(c droplet.Context) (interface{}, error) {
 	if v, ok := protocolMap[requestProtocol]; ok {
 		return v.RequestForwarding(c)
 	} else {
-		return &data.SpecCodeResponse{StatusCode: http.StatusBadRequest}, fmt.Errorf("protocol unspported %s", paramsInput.RequestProtocol)
+		return &data.SpecCodeResponse{StatusCode: http.StatusBadRequest},
+			fmt.Errorf("protocol unspported %s, need http or https. but given %s", paramsInput.RequestProtocol, paramsInput.RequestProtocol)

Review comment:
       unsupported




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan merged pull request #1166: fix: update online debug api protocol validation and error msg

Posted by GitBox <gi...@apache.org>.
juzhiyuan merged pull request #1166:
URL: https://github.com/apache/apisix-dashboard/pull/1166


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on a change in pull request #1166: fix: update online debug api protocol validation and error msg

Posted by GitBox <gi...@apache.org>.
nic-chen commented on a change in pull request #1166:
URL: https://github.com/apache/apisix-dashboard/pull/1166#discussion_r550384838



##########
File path: api/internal/handler/route_online_debug/route_online_debug.go
##########
@@ -49,6 +49,7 @@ var protocolMap map[string]ProtocolSupport
 func init() {
 	protocolMap = make(map[string]ProtocolSupport)
 	protocolMap["http"] = &HTTPProtocolSupport{}
+	protocolMap["https"] = &HTTPProtocolSupport{}
 }

Review comment:
       you could refer to:
   https://github.com/uber-go/guide/blob/master/style.md#avoid-init




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on a change in pull request #1166: fix: update online debug api protocol validation and error msg

Posted by GitBox <gi...@apache.org>.
nic-chen commented on a change in pull request #1166:
URL: https://github.com/apache/apisix-dashboard/pull/1166#discussion_r550382253



##########
File path: api/internal/handler/route_online_debug/route_online_debug.go
##########
@@ -49,6 +49,7 @@ var protocolMap map[string]ProtocolSupport
 func init() {
 	protocolMap = make(map[string]ProtocolSupport)
 	protocolMap["http"] = &HTTPProtocolSupport{}
+	protocolMap["https"] = &HTTPProtocolSupport{}
 }

Review comment:
       oh, we don't need a init function here, just a map is ok




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org