outofcoffee / imposter

Scriptable, multipurpose mock server. Run standalone mock servers, or embed mocks within your tests.

Home Page:https://imposter.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strip whitespace for comma-delimited log header config

hilsonp opened this issue · comments

Hello,

Today, I was working on the logging part and was trying to log the headers as explained here: https://docs.imposter.sh/metrics_logs_telemetry/#structured-logging

Only the first header was written until I removed the spaces after the comma in my configuration.

IMPOSTER_LOG_REQUEST_HEADERS and IMPOSTER_LOG_RESPONSE_HEADER is space sensitive

NOK: export IMPOSTER_LOG_REQUEST_HEADERS="X-MockControl, X-CorrelationId"
NOK: export IMPOSTER_LOG_REQUEST_HEADERS="X-MockControl,X-CorrelationId"

I suggest a warning in the log or stripping the spaces when imposter reads the variable.

Best regards,

Pierre

Hi @hilsonp, thanks for raising this. You are right that the config has to match the documentation exactly for this to work, so is not very forgiving with whitespace.

To improve this, as you suggested, all entries will have their whitespace trimmed as of v3.25.1.