Rename redbean Lua function GetPayload to GetBody

This breaking change improves consistency with RFC 7230 terminology.
This commit is contained in:
Paul Kulchenko 2021-10-31 16:44:29 -07:00
parent cde92c3944
commit d60e855870
2 changed files with 5 additions and 6 deletions

View file

@ -604,6 +604,9 @@ FUNCTIONS
Returns byte size of uncompressed contents of ZIP asset (or local
file if the -D flag is used)
GetBody() → str
Returns the request message body if present or an empty string.
GetCookie(name:str) → str
Returns cookie value.
@ -716,10 +719,6 @@ FUNCTIONS
GetTime() → seconds:number
Returns current time as a UNIX timestamp with 0.0001s precision.
GetPayload() → str
Returns the request message payload, or empty string if there
isn't one.
GetUrl() → str
Returns the effective Request-URL as an ASCII string, where
illegal characters or UTF-8 is guaranteed to be percent encoded,

View file

@ -4097,7 +4097,7 @@ static int LuaParseHttpDateTime(lua_State *L) {
return 1;
}
static int LuaGetPayload(lua_State *L) {
static int LuaGetBody(lua_State *L) {
lua_pushlstring(L, inbuf.p + hdrsize, payloadlength);
return 1;
}
@ -5328,6 +5328,7 @@ static const luaL_Reg kLuaFuncs[] = {
{"GetAssetComment", LuaGetAssetComment}, //
{"GetAssetMode", LuaGetAssetMode}, //
{"GetAssetSize", LuaGetAssetSize}, //
{"GetBody", LuaGetBody}, //
{"GetClientAddr", LuaGetClientAddr}, //
{"GetCookie", LuaGetCookie}, //
{"GetDate", LuaGetDate}, //
@ -5347,7 +5348,6 @@ static const luaL_Reg kLuaFuncs[] = {
{"GetParams", LuaGetParams}, //
{"GetPass", LuaGetPass}, //
{"GetPath", LuaGetPath}, //
{"GetPayload", LuaGetPayload}, //
{"GetPort", LuaGetPort}, //
{"GetRandomBytes", LuaGetRandomBytes}, //
{"GetRedbeanVersion", LuaGetRedbeanVersion}, //