Skip to content

Commit 0f124c2

Browse files
authored
Merge pull request #321 from cmu-delphi/r-custom-endpoint
R custom API endpoint
2 parents 6f868d4 + d6ae09f commit 0f124c2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

R-packages/covidcast/R/covidcast.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,10 @@ covidcast <- function(data_source, signal, time_type, geo_type, time_values,
667667

668668
# Helper function to request and parse epidata
669669
.request <- function(params) {
670-
# API call
671-
response <- httr::GET(COVIDCAST_BASE_URL, httr::user_agent("covidcastR"),
672-
query=params)
670+
# API call. Allow base API URL to be replaced, e.g. to use a staging/testing
671+
# server when needed.
672+
response <- httr::GET(getOption("covidcast.base_url", default = COVIDCAST_BASE_URL),
673+
httr::user_agent("covidcastR"), query = params)
673674

674675
httr::stop_for_status(response, task = "fetch data from API")
675676

0 commit comments

Comments
 (0)