Closed jtarvainen closed 3 months ago
@jtarvainen Will review!
@jtarvainen Let's get the node-hl7-client package fixed first before I tackle this.
@jtarvainen So I moved it here cause the server doesn't do the parsing anyway. This is just a result of the node-hl7 client not doing it correctly and now corrected in #97
And the unit test:
and
All pass, @jtarvainen
Looks good to me!
@jtarvainen This package has been released! Be sure to leave me a star!
If the inbound message ends with a line break ('\n', '\r', '\r\n'), message parsing fails with a
HL7FatalError
("Segment must have a name."). This is especially problematic since the original message is stored as a private variable in the response, which also causesres.sendResponse('AA')
to fail if the original message contains a trailing line break.For example, this message cannot be parsed:
But this can:
I would suggest that the inbound message string be automatically trimmed (
String.prototype.trim()
) upon reception (i.e. before it's set inreq._message
andres._message
) to remove any trailing line breaks.Also, it'd be great if the library would log the error in the
res.sendResponse()
catch block before sending an "AE" message (the "AA" message creation failure is currently silent).Thanks!