3 HttpParser <- R6::R6Class(
8 initialize = function()
12 parseJSONResponse = function(serverResponse)
14 parsed_response <- httr::content(serverResponse, as = "parsed", type = "application/json")
17 parseWebDAVResponse = function(response, uri)
19 text <- rawToChar(response$content)
20 doc <- XML::xmlParse(text, asText=TRUE)
21 base <- paste(paste("/", strsplit(uri, "/")[[1]][-1:-3], sep="", collapse=""), "/", sep="")
23 XML::xpathApply(doc, "//D:response/D:href", function(node) {
24 sub(base, "", URLdecode(XML::xmlValue(node)), fixed=TRUE)
27 result <- result[result != ""]
31 extractFileSizeFromWebDAVResponse = function(response, uri)
33 text <- rawToChar(response$content)
34 doc <- XML::xmlParse(text, asText=TRUE)
36 base <- paste(paste("/", strsplit(uri, "/")[[1]][-1:-3], sep="", collapse=""), "/", sep="")
37 result <- XML::xpathApply(doc, "//D:response/D:propstat/D:prop/D:getcontentlength", function(node) {