Skip to content

Commit 95edece

Browse files
authored
Update README.md
HTTP headers and status: Removed deprecated comments, unused variable (req) and simplified function response
1 parent dc03485 commit 95edece

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,10 @@ Example
314314
```Lua
315315
-- Tarantool, stored procedure
316316
function foo(req)
317-
return
318-
-- First arg. if __ngx exists and tnt_eval is used, then it will be
319-
-- readed by nginx
320-
{
321-
ngx = {
322-
200, -- set status HTTP 200
323-
{ ["X-Tarantool"] = "FROM_TNT" } -- set headers
324-
}
325-
},
326-
req,
317+
return {
318+
200, -- set status HTTP 200
319+
{ ["X-Tarantool"] = "FROM_TNT" } -- set headers
320+
}
327321

328322
end
329323
```
@@ -371,8 +365,8 @@ Example
371365
local result = answ["result"]
372366
373367
if result ~= nil then
374-
ngx.status = result[1]["ngx"][1]
375-
for k, v in pairs(result[1]["ngx"][2]) do
368+
ngx.status = result[1]
369+
for k, v in pairs(result[2]) do
376370
ngx.header[k] = v
377371
end
378372

0 commit comments

Comments
 (0)