Skip to content

Commit a53ac1e

Browse files
authored
Merge pull request #11 from ysugimoto/fix-test-and-contributors
fix test, add contributor
2 parents 2a79215 + f1c8ae1 commit a53ac1e

File tree

6 files changed

+17
-4
lines changed

6 files changed

+17
-4
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77
- checkout
88
- run: luarocks install luaunit
99
- run: luarocks install lua-protobuf
10+
- run: luarocks install penlight
1011
- run: make test
1112

1213
publish:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.PHONY: test
22

33
test:
4-
LUAUNIT=1 lua test.lua
4+
LUAUNIT=1 lua tests/test.lua

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,9 @@ By calling `polyfill()` , grpc-web-text mode will be succeed to proxy to backend
325325

326326
MIT
327327

328-
## Author
328+
## Contributors
329329

330-
Yoshiaki Sugimoto
330+
- [ysugimoto](https://github.com/ysugimoto)
331+
- [kgoguevgoget](https://github.com/kgoguevgoget)
331332

332333

grpc-gateway/util.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ _M.map_message = function(field, default_values)
7474
-- Its easier to work with the data, if the default_values was already populated with the inital JSON request.
7575
-- This could be moved completely outside the map_message function because we should only populate this once throughout the lifecycle of the request
7676
-- Due to to the recursive calls, We check if the size of the table is empty or 0 in order to populate the data once.
77-
if isempty(default_values) then
77+
if isempty(default_values or {}) then
7878
if ngx.req.get_method() == "POST" then
7979
if string.find(ngx.req.get_headers()["Content-Type"] or "", "application/json") then
8080
default_values = json.decode(ngx.req.get_body_data())

tests/table/isempty.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
local tablex = require('pl.tablex')
2+
3+
-- This file is fixure for luajit2's table.isempty function.
4+
-- This function might not be same as original table.isempty implementation,
5+
-- but it'ss OK beucase our function will use as just checking table size is zero or not
6+
local function isempty(tbl)
7+
return tablex.size(tbl) == 0
8+
end
9+
10+
return isempty

test.lua renamed to tests/test.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package.path = package.path .. ";./?.lua"
2+
package.path = package.path .. ";./tests/?.lua"
23

34
local lu = require("luaunit")
45
local util = require("grpc-gateway.util")

0 commit comments

Comments
 (0)