unable to rename header

669 views Asked by At

i want to rename my api key header from api-key to apikey with this request

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"

but i am getting error

{"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}

any suggestion to solve this issue thank you

1

There are 1 answers

0
Ôrel On BEST ANSWER

The syntax of config.rename.headers= is header-old-name:header-new-name

So in your case:

 curl -X POST http://localhost:8001/plugins/ \
    --data "name=request-transformer"  \
    --data "config.rename.headers=api-key:apikey"