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 2021/01/20 06:52:37 UTC

[GitHub] [apisix] nanamikon edited a comment on issue #3351: bug: Not support updating snis with PATCH

nanamikon edited a comment on issue #3351:
URL: https://github.com/apache/apisix/issues/3351#issuecomment-763379950


   I write a test case for this situation
   Test 1 success, but Test 2 fail because of 400
   
   ```
   === TEST 1: not unwanted data, PUT
   --- config
       location /t {
           content_by_lua_block {
               local json = require("toolkit.json")
               local t = require("lib.test_admin")
   
               local ssl_cert = t.read_file("t/certs/apisix.crt")
               local ssl_key =  t.read_file("t/certs/apisix.key")
               local data = {cert = ssl_cert, key = ssl_key, snis = {"not-unwanted-post.com"}}
               local code, message, res = t.test('/apisix/admin/ssl/1',
                   ngx.HTTP_PUT,
                   json.encode(data)
               )
   
               if code >= 300 then
                   ngx.status = code
                   ngx.say(message)
                   return
               end
   
               res = json.decode(res)
               res.node.value.create_time = nil
               res.node.value.update_time = nil
               res.node.value.cert = ""
               res.node.value.key = ""
               res.node.key = nil
               ngx.say(json.encode(res))
           }
       }
   --- response_body
   {"action":"set","node":{"value":{"cert":"","id":"1","key":"","snis":["not-unwanted-post.com"],"status":1}}}
   
   
   === TEST 2: update snis, PATCH
   --- config
       location /t {
           content_by_lua_block {
               local json = require("toolkit.json")
               local t = require("lib.test_admin")
   
               local data = {"update1.com", "update2.com"}
               local code, message, res = t.test('/apisix/admin/ssl/1/snis',
                   ngx.HTTP_PATCH,
                   json.encode(data)
               )
   
               if code >= 300 then
                   ngx.status = code
                   ngx.say(message)
                   return
               end
           }
       }
   
   
   ```


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