Previously, headers had to be a named list. In order to have no headers (besides the ones httpuv adds automatically), headers would have to be an empty named list, which is a little awkward to create. With this change, headers can be NULL, list() (an empty unnamed list), or it can be unset.
For example, this app would not work before, but it does now:
s <- startServer("127.0.0.1", 5000,
list(
call = function(req) {
list(
status = 200L,
headers = list(),
body = ""
)
}
)
)
The result:
$ curl -i http://localhost:5000
HTTP/1.1 200 OK
Date: Thu, 26 Nov 2020 16:33:55 GMT
Content-Length: 0
Previously,
headers
had to be a named list. In order to have no headers (besides the ones httpuv adds automatically),headers
would have to be an empty named list, which is a little awkward to create. With this change,headers
can beNULL
,list()
(an empty unnamed list), or it can be unset.For example, this app would not work before, but it does now:
The result: