I am trying to pass header "X-Name" from postman then access it from API which is build using Plumber R.
However, I am not able to access it. using following code,
req$HTTP_X-NAME
, then i am getting following error.
Error in (function (id, time_frame, req, res) : object 'name' not found\n"
If I use following code, I get NULL values,
req$HTTP_X_NAME
or
req[["HTTP_X-NAME"]
or
req[["HTTP_X-Name"]
Following is my code:
#* @get /
healthCheck <- function(){
print("It's Running")
}
#* @param id:int Random Number
#* @post /test/values
#* @get /test/values
test <- function(id, req, res){
print(req[["HTTP_X-Name"]])
return(req[["HTTP_X-Name"]])
}