I’ve followed the “Create Custom Authentication Plugin with NodeJS” guide from Here
One thing I’ve noticed that the headers are mangled in an awkward way.
For example is the following call was issued:
curl -H "Authorization: token" -H "GPRC-Authorization: token2" http://portal-instance2.com:8888/http-bin/get
From the GRPC handler, I am seeing the headers are mangled to capitalized kabab case instead of what was passed in via the headers.
{ hook_type: 'CustomKeyCheck',
hook_name: 'MyAuthMiddleware',
request:
{ headers:
{ Mycustomheader: 'mycustomvalue here!',
'User-Agent': 'curl/7.54.0',
Accept: '*/*',
Authorization: 'token',
'Gprc-Authorization': 'token2',
Host: 'portal-instance2.com:8888' },
The above was logged from:
const authMiddleware = (obj, callback) => {
var req = obj.request
console.log(obj)
})
I am curious if there are ways to stop this behaviour or standardize the keys to all lower case, since header keys are case insensitive.