Skip to content

Commit

Permalink
Added compatibility flags to update
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaAtulTewari authored and ns476 committed Aug 2, 2024
1 parent 8070ebd commit 1a2002d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/workerd/api/http-test.wd-test
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const unitTests :Workerd.Config = (
( name = "SERVICE", service = "http-test" )
],
compatibilityDate = "2023-08-01",
compatibilityFlags = ["nodejs_compat", "service_binding_extra_handlers"],
compatibilityFlags = ["nodejs_compat", "service_binding_extra_handlers", "cache_header_enabled"],
)
),
],
Expand Down
4 changes: 4 additions & 0 deletions src/workerd/api/http.c++
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,10 @@ jsg::Ref<Request> Request::constructor(
}

KJ_IF_SOME(c, initDict.cache) {
bool cacheHeaderEnabled = FeatureFlags::get(js).getCacheHeaderEnabled();
if(!cacheHeaderEnabled) {
JSG_FAIL_REQUIRE(TypeError, kj::str("Unsupported cache mode: ", c, "\nYou may need to enable a compatability flag."));
}
cacheMode = getCacheModeFromName(c);
}

Expand Down
6 changes: 6 additions & 0 deletions src/workerd/io/compatibility-date.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -504,4 +504,10 @@ struct CompatibilityFlags @0x8f8c1b68151b6cef {
$compatDisableFlag("legacy_module_registry")
$experimental;
# Enables of the new module registry implementation.

cacheHeaderEnabled @53 :Bool
$compatEnableFlag("cache_header_enabled")
$compatDisableFlag("cache_header_disabled")
$experimental;
# Enables the use of no-cache and no-store headers from requests
}

0 comments on commit 1a2002d

Please sign in to comment.