r - How to capture response header of a plumber endpoint? -


is there way capture response headers of plumber based api response programmatically?

here's have:

    library(plumber)     library(futile.logger)      # creating new router     router <- plumber::plumber$new()      # instancing filter logging request details     logfilter <- expression(function(req) {      # creating log entry     req_data <- paste0(date(),  "from ", req$remote_addr  #and on)     # appending log entry logger     flog.info(msg = req_data, name = "mylogger")     # passing request next handler     forward()     })      # logfilter attached router     router$addfilter(name="logger", expr=logfilter)      # defining function, used endpoint     fun_1 <- expression(function(...) {...})      # creating endpoint @ router fun_1     router$addendpoint(verbs=c("post"), path="/fun_1", expr = fun_1)      # plumbing api @ port 8000     router$run(port=8000) 

and i'm looking way capture , log contents , headers of plumber generated response.

i've tried instancing preemt-filter right after endpoint. doesn't seem handle issue.

also, i've tried pass res variable endpoint function , investigate within function, like:

flog.info(paste0("res headers: ", res$headers), name = "mylogger") 

however, in case, headers empty.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -