diff options
-rw-r--r-- | server.lua | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -40,11 +40,14 @@ return function(env) end local data - if env.CONTENT_LENGTH then + local length = env.CONTENT_LENGTH and tonumber( + env.CONTENT_LENGTH + ) or 0 + if length > 0 then local success success, data = pcall( json.decode, - env.input:read(env.CONTENT_LENGTH) + env.input:read(length) ) if not success then return wrap(400, nil, 'Request not in JSON format') |