(headers)
| 1431 | } |
| 1432 | |
| 1433 | function parseHeaders(headers) { |
| 1434 | if (!headers) return {}; |
| 1435 | |
| 1436 | const parsed = {}; |
| 1437 | let key; |
| 1438 | let val; |
| 1439 | let i; |
| 1440 | |
| 1441 | headers && |
| 1442 | headers.split('\n').forEach(function parser(line) { |
| 1443 | i = line.indexOf(':'); |
| 1444 | key = line.substring(0, i).trim().toLowerCase(); |
| 1445 | val = line.substring(i + 1).trim(); |
| 1446 | |
| 1447 | if (!key) { |
| 1448 | return; |
| 1449 | } |
| 1450 | |
| 1451 | parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; |
| 1452 | }); |
| 1453 | |
| 1454 | return parsed; |
| 1455 | } |
| 1456 | |
| 1457 | function parseBody(body, contentType, valueFormatFn) { |
| 1458 | if (contentType === 'text/plain' || !body) { |
no test coverage detected