mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 19:43:32 +00:00
472b95fea3
If your redbean `/.init.lua` file defines a global callable named `OnHttpRequest` then redbean will delegate all serving control to your function. You may then restore the default serving paths, by calling the new `Route()`, `RouteHost()`, and `RoutePath()` APIs. Closes #150
8 lines
192 B
Lua
8 lines
192 B
Lua
-- redbean xhr handler demo
|
|
hdr = GetHeader('x-custom-header')
|
|
if hdr then
|
|
SetHeader('Vary', 'X-Custom-Header')
|
|
SetHeader('X-Custom-Header', 'hello ' .. hdr)
|
|
else
|
|
ServeError(400)
|
|
end
|