summaryrefslogtreecommitdiff
path: root/ext/http/00_serve.js
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-07-19 12:43:49 -0600
committerGitHub <noreply@github.com>2023-07-19 12:43:49 -0600
commitaa95a3a6e04a7b0d1a06f4e149793a6970bda3aa (patch)
treed5416d8c3b34d7cf0006facff8193986264abd12 /ext/http/00_serve.js
parent5919f31891f464fb8975084795550d7e731c12de (diff)
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)
Diffstat (limited to 'ext/http/00_serve.js')
-rw-r--r--ext/http/00_serve.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/http/00_serve.js b/ext/http/00_serve.js
index 95079f412..e881cca2a 100644
--- a/ext/http/00_serve.js
+++ b/ext/http/00_serve.js
@@ -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) {