Accept buffers for cert/key in createServer
This commit is contained in:
parent
cf8adf4a4a
commit
501fb5a46b
|
@ -258,10 +258,12 @@ function Server(options) {
|
|||
|
||||
if (options.certificate || options.key) {
|
||||
if (!(options.certificate && options.key) ||
|
||||
typeof (options.certificate) !== 'string' ||
|
||||
typeof (options.key) !== 'string') {
|
||||
throw new TypeError('options.certificate and options.key (string) ' +
|
||||
'are both required for TLS');
|
||||
(typeof (options.certificate) !== 'string' &&
|
||||
!Buffer.isBuffer(options.key)) ||
|
||||
(typeof (options.key) !== 'string' &&
|
||||
!Buffer.isBuffer(options.key))) {
|
||||
throw new TypeError('options.certificate and options.key ' +
|
||||
'(string or buffer) are both required for TLS');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue