Skip to content

Commit

Permalink
simplified to use trim as other clients do
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Jun 1, 2021
1 parent 8fcc608 commit 0906a19
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions nats-base-client/headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,9 @@ export class MsgHdrsImpl implements MsgHdrs {
} else {
lines.slice(1).map((s) => {
if (s) {
let offset = 2;
let idx = s.indexOf(": ");
if (idx === -1) {
// java is not writing the space
idx = s.indexOf(":");
offset = 1;
}
const idx = s.indexOf(":");
const k = s.slice(0, idx);
const v = s.slice(idx + offset);
const v = s.slice(idx + 1).trim();
mh.append(k, v);
}
});
Expand Down

0 comments on commit 0906a19

Please sign in to comment.