@@ -1540,32 +1540,30 @@ bool apply_cache_override(JSContext *cx, HandleObject self) {
1540
1540
1541
1541
uint8_t tag = builtins::CacheOverride::abi_tag (override );
1542
1542
1543
- fastly_option_u32_t ttl_option;
1543
+ bool has_ttl = true ;
1544
+ uint32_t ttl;
1544
1545
RootedValue val (cx, builtins::CacheOverride::ttl (override ));
1545
1546
if (val.isUndefined ()) {
1546
- ttl_option. is_some = false ;
1547
+ has_ttl = false ;
1547
1548
} else {
1548
- ttl_option.is_some = true ;
1549
- ttl_option.val = val.toInt32 ();
1549
+ ttl = val.toInt32 ();
1550
1550
}
1551
1551
1552
- fastly_option_u32_t swr_option;
1552
+ bool has_swr = true ;
1553
+ uint32_t swr;
1553
1554
val = builtins::CacheOverride::swr (override );
1554
1555
if (val.isUndefined ()) {
1555
- swr_option. is_some = false ;
1556
+ has_swr = false ;
1556
1557
} else {
1557
- swr_option.is_some = true ;
1558
- swr_option.val = val.toInt32 ();
1558
+ swr = val.toInt32 ();
1559
1559
}
1560
1560
1561
1561
xqd_world_string_t sk_str;
1562
- fastly_option_string_t sk_opt;
1563
1562
val = builtins::CacheOverride::surrogate_key (override );
1564
1563
if (val.isUndefined ()) {
1565
- sk_opt. is_some = false ;
1564
+ sk_str. len = 0 ;
1566
1565
} else {
1567
1566
UniqueChars sk_chars;
1568
- sk_opt.is_some = true ;
1569
1567
sk_chars = encode (cx, val, &sk_str.len );
1570
1568
if (!sk_chars)
1571
1569
return false ;
@@ -1575,7 +1573,8 @@ bool apply_cache_override(JSContext *cx, HandleObject self) {
1575
1573
fastly_error_t err;
1576
1574
return HANDLE_RESULT (cx,
1577
1575
xqd_fastly_http_req_cache_override_set (
1578
- request_handle (self), tag, &ttl_option, &swr_option, &sk_opt, &err),
1576
+ request_handle (self), tag, has_ttl ? &ttl : NULL , has_swr ? &swr : NULL ,
1577
+ sk_str.len ? &sk_str : NULL , &err),
1579
1578
err);
1580
1579
}
1581
1580
0 commit comments