mia-platform/custom-plugin-lib

null clientType is converted to 'null' string

gbarbon opened this issue · 1 comments

The feature or bug you are proposing

The library is converting the null value into the null string headers, e.g. for the CLIENTTYPE_HEADER_KEY. This results in forwarding that given header with the null string as value even when the header is actually not provided/forwarder.

The description of the bug or the rationale of your proposal

The library should not forward heraders when those are set to null, or at least forward those with an empty string instead.

Note that while this bug has been discovered for the CLIENTTYPE_HEADER_KEY, it is impacting also other headers.

A snippet of code for replicating the issue or showing the proposal usage if applicable

A possible solution can be replacing:

function getClientType(clientType) {
  return clientType || null
}

with:

function getClientType(clientType) {
  return clientType || ''
}

The expected result for your bug

The library should not forward a header if the header is set to null.

Your environment

node: 12.19.0-alpine
custom-plugin-lib: 4.2.0
os: --

This is resolved by #225 and it will be released in the next version