Firstsawyou commented on a change in pull request #2830:
URL: https://github.com/apache/apisix/pull/2830#discussion_r529603958



##########
File path: apisix/plugins/hmac-auth.lua
##########
@@ -224,6 +224,13 @@ local function generate_signature(ctx, secret_key, params)
 
         for _, key in pairs(keys) do
             local param = args[key]
+            -- when args without `=<value>`, value is treated as true.
+            -- In order to be compatible with args lacking `=<value>`,
+            -- we need to replace true with an empty string.
+            if type(param) == "boolean" then
+                param = ""

Review comment:
       I tested it, and the following is my test result:
   
   node.js: curl "http://localhost:8080/args?name=jack&age";
   
   ```
   node.js, args name:jack
   node.js, args age:
   ```
   
   python: curl "http://localhost:8080/args?name=jack&age";
   
   ```
   ParseResult(scheme='http', netloc='127.0.0.1:8080', path='/args', params='', 
query='name=jack&age', fragment='')
   {'age': [''], 'name': ['jack']}
   ```
   
   golang: curl  "http://localhost:8080/args?name=jack&age";
   
   ```
   map[age:[] name:[jack]]
   args value:  jack 
   ```




----------------------------------------------------------------
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:
[email protected]


Reply via email to