Trim fields when normalizing
This commit is contained in:
parent
583765a298
commit
34c446909e
@ -45,7 +45,7 @@ function getEventData (req, res) {
|
||||
}
|
||||
|
||||
function normalizedField (field) {
|
||||
return field.toString().substr(0, MAX_LENGTH);
|
||||
return field.toString().trim().substr(0, MAX_LENGTH);
|
||||
}
|
||||
|
||||
module.exports = pubSubMetrics;
|
||||
|
@ -119,7 +119,7 @@ describe('pubsub metrics middleware', function () {
|
||||
global.environment.pubSubMetrics.enabled = true;
|
||||
const eventAttributes = buildEventAttributes(200);
|
||||
const maxLength = 100;
|
||||
const eventName = tooLongField.substr(0, maxLength);
|
||||
const eventName = tooLongField.trim().substr(0, maxLength);
|
||||
|
||||
testClient = new TestClient(mapConfig, 1234, badHeaders);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user