From 3be5aac0765ac5f0740862650ca3bb63e5811bed Mon Sep 17 00:00:00 2001 From: afwillia Date: Tue, 30 Jul 2024 14:14:22 -0700 Subject: [PATCH] check response for certified attribute, otherwise return false --- R/synapse_rest_api.R | 4 +++- functions/synapse_rest_api.R | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/R/synapse_rest_api.R b/R/synapse_rest_api.R index 3d3cedaa..94cac87f 100644 --- a/R/synapse_rest_api.R +++ b/R/synapse_rest_api.R @@ -39,7 +39,9 @@ synapse_is_certified <- function(url="https://repo-prod.prod.sagebase.org/repo/v url_req <- file.path(url, ownerid, endpoint) req <- httr::GET(url_req) resp <- httr::content(req) - resp[["certified"]] + if ("certified" %in% names(resp)) { + return(resp[["certified"]]) + } else return(FALSE) } diff --git a/functions/synapse_rest_api.R b/functions/synapse_rest_api.R index 3d3cedaa..94cac87f 100644 --- a/functions/synapse_rest_api.R +++ b/functions/synapse_rest_api.R @@ -39,7 +39,9 @@ synapse_is_certified <- function(url="https://repo-prod.prod.sagebase.org/repo/v url_req <- file.path(url, ownerid, endpoint) req <- httr::GET(url_req) resp <- httr::content(req) - resp[["certified"]] + if ("certified" %in% names(resp)) { + return(resp[["certified"]]) + } else return(FALSE) }