Skip to content

Commit d0a4906

Browse files
committed
cleaned up the code a bit to reduce code duplication.
1 parent 5b86429 commit d0a4906

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/resty/upload.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ local STATE_READING_HEADER = 2
1111
local STATE_READING_BODY = 3
1212
local STATE_EOF = 4
1313

14-
local mt = { __index = resty.upload }
14+
local class = resty.upload
15+
16+
local mt = { __index = class }
1517

1618
local sub = string.sub
1719
local req_socket = ngx.req.socket
@@ -248,7 +250,7 @@ state_handlers = {
248250

249251

250252
-- to prevent use of casual module global variables
251-
getmetatable(resty.upload).__newindex = function (table, key, val)
253+
getmetatable(class).__newindex = function (table, key, val)
252254
error('attempt to write to undeclared variable "' .. key .. '": '
253255
.. debug.traceback())
254256
end

0 commit comments

Comments
 (0)