Skip to content

Commit ea2bda7

Browse files
committed
avoid useless line trimming in parseResponse()
1 parent 7f73a4c commit ea2bda7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/util.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,16 @@ async function parseResponse(output) {
188188
});
189189

190190
for await (let line of rl) {
191-
line = line.trim();
192-
193191
const index = line.indexOf(":");
192+
194193
if (index !== -1) {
195194
const key = line.slice(0, index).trim();
196-
const value = line.slice(index + 1).trim();
195+
const value = line.slice(index + 1);
196+
197197
if (key.toLowerCase() === "status") {
198198
status = parseInt(value, 10);
199199
} else {
200-
headers[key] = value;
200+
headers[key] = value.trim();
201201
}
202202
} else if (line.match(/^HTTP\/1\.1/i)) {
203203
status = parseInt(line.split(/\s+/)[1], 10);

0 commit comments

Comments
 (0)