MazamaScience/beakr

cors() not working as described

Closed this issue · 0 comments

I have pushed up beakr 0.4 to GitHub but cannot get the cors() functionality to work. It may only be a documentation issue but, if so, that means that the core() function arguments need a LOT more description.

I tried running the following in RStudio:

library(beakr)

newBeakr() %>% 
  
  cors() %>%
  
  httpGET(path = "/hi", function(req, res, err) {
    print("Hello, World!")
  }) %>% 
  httpGET(path = "/bye", function(req, res, err) {
    print("Farewell, my friends.")
  }) %>% 
  
  handleErrors() %>%
  
  listen(host = "127.0.0.1", port = 25118) 

It works if I comment out the cors() %>% line but fails if I uses it with the following error message:

Error in ans[ypos] <- rep(yes, length.out = len)[ypos] : 
  replacement has length zero

Here is my environment:

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] beakr_0.4.0

loaded via a namespace (and not attached):
[1] Rcpp_1.0.6            rstudioapi_0.13       magrittr_2.0.1       
[4] webutils_1.1          hms_0.5.3             lattice_0.20-41      
[7] R6_2.5.0              rlang_0.4.10          stringr_1.4.0        
[10] tools_4.0.2           rgdal_1.5-18          grid_4.0.2           
[13] lambda.r_1.2.4        futile.logger_1.4.3   ellipsis_0.3.1       
[16] tibble_3.0.6          lifecycle_0.2.0       crayon_1.3.4         
[19] readr_1.4.0           formatR_1.7           later_1.1.0.1        
[22] base64enc_0.1-3       vctrs_0.3.6           promises_1.1.1       
[25] futile.options_1.0.1  sp_1.4-5              stringi_1.5.3        
[28] compiler_4.0.2        pillar_1.4.7          MazamaCoreUtils_0.4.7
[31] jsonlite_1.7.2        httpuv_1.5.5          pkgconfig_2.0.3