@@ -26,8 +26,10 @@ enable <- function(adapter = NULL, options = list(), quiet = FALSE) {
2626 if (! adapter %in% webmockr_adapters ) {
2727 abort(" adapter must be one of 'crul', 'httr', or 'httr2'" )
2828 }
29- if (! requireNamespace(adapter , quietly = TRUE )) {
30- message(adapter , " not installed, skipping enable" )
29+ if (! is_installed(adapter )) {
30+ if (! quiet ) {
31+ message(adapter , " not installed, skipping enable" )
32+ }
3133 return (invisible (FALSE ))
3234 }
3335 http_lib_adapter_registry $ adapters [[which(adnms == adapter )]]$ enable(quiet )
@@ -37,8 +39,10 @@ enable <- function(adapter = NULL, options = list(), quiet = FALSE) {
3739 function (z ) {
3840 pkgname <- z $ client
3941 # check if package installed first
40- if (! requireNamespace(pkgname , quietly = TRUE )) {
41- message(pkgname , " not installed, skipping enable" )
42+ if (! is_installed(pkgname )) {
43+ if (! quiet ) {
44+ message(pkgname , " not installed, skipping enable" )
45+ }
4246 FALSE
4347 } else {
4448 # if instaled, enable
@@ -70,8 +74,10 @@ disable <- function(adapter = NULL, options = list(), quiet = FALSE) {
7074 if (! adapter %in% webmockr_adapters ) {
7175 abort(" adapter must be one of 'crul', 'httr', or 'httr2'" )
7276 }
73- if (! requireNamespace(adapter , quietly = TRUE )) {
74- message(adapter , " not installed, skipping disable" )
77+ if (! is_installed(adapter )) {
78+ if (! quiet ) {
79+ message(adapter , " not installed, skipping disable" )
80+ }
7581 return (invisible (FALSE ))
7682 }
7783 http_lib_adapter_registry $ adapters [[which(adnms == adapter )]]$ disable(quiet )
@@ -81,8 +87,10 @@ disable <- function(adapter = NULL, options = list(), quiet = FALSE) {
8187 function (z ) {
8288 pkgname <- z $ client
8389 # check if package installed first
84- if (! requireNamespace(pkgname , quietly = TRUE )) {
85- message(pkgname , " not installed, skipping disable" )
90+ if (! is_installed(pkgname )) {
91+ if (! quiet ) {
92+ message(pkgname , " not installed, skipping disable" )
93+ }
8694 FALSE
8795 } else {
8896 # if instaled, disable
0 commit comments