R/httpget_file.R

Defines functions httpget_file

httpget_file <- function(fullpath){
  fullpath <- do.call("file.path", as.list(fullpath));
  res$checkfile(fullpath);

  #only GET/POST allowed
  res$checkmethod(c("GET", "POST"));
  
  switch(req$method(),
    "GET" = res$sendfile(fullpath),
    "POST" = execute_file(fullpath),
    stop("invalid method: ", req$method())
  );  
}
jeroenooms/opencpu documentation built on Aug. 21, 2023, 12:13 p.m.