New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add content Type and Disposition #455
Conversation
allow a better handling of return files.
corrected documentation |
Codecov Report
@@ Coverage Diff @@
## master #455 +/- ##
==========================================
+ Coverage 89.84% 89.98% +0.13%
==========================================
Files 29 29
Lines 1527 1537 +10
==========================================
+ Hits 1372 1383 +11
+ Misses 155 154 -1
Continue to review full report at Codecov.
|
Add test for content type disposition
@ycphs Thank you for the PR and tests! With content disposition being tied to content type, how do you feel about making # untested
serializer_content_type <- function(type, disposition = NULL, filename = NULL) {
if (missing(type)) {
stop("You must provide the custom content type to the serializer_content_type_disposition")
}
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
if (!is.null(disposition)) {
disposition <- match.arg(disposition, c("inline", "attachment"))
if (disposition == "attachment" && !is.null(filename)) {
filename <- as.character(filename)
if (grepl("\"", filename, fixed = TRUE)) {
stop("quotes can not be used in the value of `filename`")
}
disposition <- paste0(disposition, "; filename=\"", filename, "\"")
}
}
function(val, req, res, errorHandler) {
tryCatch({
res$setHeader("Content-Type", type)
if (!is.null(disposition)) {
res$setHeader("Content-Disposition", disposition)
}
res$body <- val
return(res$toResponse())
}, error=function(e) {
errorHandler(req, res, e)
})
}
} |
@schloerke: Yes for me that's also good. Do you change it yourself or should I change it? |
@schloerke I updated the method and tests. |
change according of appveyor.yml to: Provide more advice re: env vars #147 |
|
The serializer contentType returned named files without extension.