test: refactor test-tls-cert-chains-in-ca
When splitting PEM string into separate certs, use non-capturing regexp to avoid having to put the split string back with .map(). As a bonus, this splits the PEM into two certs, rather than 2 certs and a third crufty whitespace-only string. PR-URL: https://github.com/nodejs/node/pull/11367 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
This commit is contained in:
parent
3429991d8b
commit
e2d7df6fdc
@ -12,8 +12,7 @@ const {
|
||||
|
||||
// agent6-cert.pem includes cert for agent6 and ca3, split it apart and
|
||||
// provide ca3 in the .ca property.
|
||||
const agent6Chain = keys.agent6.cert.split('-----END CERTIFICATE-----')
|
||||
.map((c) => { return c + '-----END CERTIFICATE-----'; });
|
||||
const agent6Chain = keys.agent6.cert.split(/(?=-----BEGIN CERTIFICATE-----)/);
|
||||
const agent6End = agent6Chain[0];
|
||||
const agent6Middle = agent6Chain[1];
|
||||
connect({
|
||||
|
Loading…
x
Reference in New Issue
Block a user