0

我想用这个请求将我的 api 密钥头从 api-key 重命名为 apikey

curl -X POST http://localhost:8001/plugins \ 
--data "name=request-transformer" \ 
--data-urlencode "config.rename.headers=apikey:\$(headers['api-key'] or 'api-key')" \ 
--data "config.remove.headers=api-key"

但我收到错误

{"message":"schema violation (config.rename: {\n headers = {\n \"'$(headers['api-key'] or 'api-key')' is not a valid header\"\n }\n})","name":"schema violation","fields":{"config":{"rename":{"headers":["'$(headers['api-key'] or 'api-key')' is not a valid header"]}}},"code":2}

任何解决此问题的建议谢谢

4

1 回答 1

0

的语法config.rename.headers=header-old-name:header-new-name

所以在你的情况下:

 curl -X POST http://localhost:8001/plugins/ \
    --data "name=request-transformer"  \
    --data "config.rename.headers=api-key:apikey"
于 2021-05-18T22:21:07.890 回答