1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00

fix(ext/http): Error on deprecated/unavailable features (#19880)

Throws an error when user code attempts to use unsupported options (may
help reduce confusion when migrating to Deno.serve)
This commit is contained in:
Matt Mastracci 2023-07-19 12:43:49 -06:00 committed by GitHub
parent 5919f31891
commit aa95a3a6e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -627,6 +627,17 @@ function serve(arg1, arg2) {
reusePort: options.reusePort ?? false,
};
if (options.certFile || options.keyFile) {
throw new TypeError(
"Unsupported 'certFile' / 'keyFile' options provided: use 'cert' / 'key' instead.",
);
}
if (options.alpnProtocols) {
throw new TypeError(
"Unsupported 'alpnProtocols' option provided. 'h2' and 'http/1.1' are automatically supported.",
);
}
let listener;
if (wantsHttps) {
if (!options.cert || !options.key) {