RedemptionC commented on issue #2073:
URL: 
https://github.com/apache/apisix-dashboard/issues/2073#issuecomment-899633861


   it seems to be due to the lack of name field in this test:
   
[this](https://github.com/apache/apisix-dashboard/blob/cb5f4fad360a5fff486ade063ddf6e8bba61355f/api/test/e2enew/upstream/upstream_test.go#L831)
   compare the ouput below:
   ```sh
   ❯ curl http://127.0.0.1:9000/apisix/admin/upstreams/u1  -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -H "Authorization: $(curl -s  
localhost:9000/apisix/admin/user/login -X POST -d 
'{"username":"admin","password":"admin"}'  | jq -r '.data | .token')"  -i -X 
PUT -d '
    
   {                  
       "type":"roundrobin",
       "nodes":{
           "39.97.63.215:80": 1
       }
   }'
   HTTP/1.1 400 Bad Request
   Access-Control-Allow-Credentials: true
   Access-Control-Allow-Headers: Authorization
   Access-Control-Allow-Methods: *
   Access-Control-Allow-Origin: *
   Content-Type: application/json
   X-Request-Id: 8830f286-8e40-440c-9898-2ab45794233d
   Date: Mon, 16 Aug 2021 16:03:41 GMT
   Content-Length: 111
   
   {"code":10000,"message":"upstream name 
exists","data":null,"request_id":"8830f286-8e40-440c-9898-2ab45794233d"}% 
   ```
   and
   ```sh
   ❯ curl http://127.0.0.1:9000/apisix/admin/upstreams/u1  -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -H "Authorization: $(curl -s  
localhost:9000/apisix/admin/user/login -X POST -d 
'{"username":"admin","password":"admin"}'  | jq -r '.data | .token')"  -i -X 
PUT -d ' 
   {
       "name":"hello",
       "type":"roundrobin",
       "nodes":{
           "39.97.63.215:80": 1
       }
   }'
   HTTP/1.1 200 OK
   Access-Control-Allow-Credentials: true
   Access-Control-Allow-Headers: Authorization
   Access-Control-Allow-Methods: *
   Access-Control-Allow-Origin: *
   Content-Type: application/json
   X-Request-Id: 4dd846f0-0de9-4b03-8759-2dc84a3ab5f3
   Date: Mon, 16 Aug 2021 16:04:16 GMT
   Content-Length: 209
   
   
{"code":0,"message":"","data":{"id":"u1","create_time":1629129856,"update_time":1629129856,"nodes":{"39.97.63.215:80":1},"type":"roundrobin","name":"hello"},"request_id":"4dd846f0-0de9-4b03-8759-2dc84a3ab5f3"}%
   ```


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to