Skip to content

Commit

Permalink
review: add unit-test for request object
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Jan 21, 2023
1 parent 5dfcceb commit 5111904
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions test/unit/request_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,23 @@ describe('require', function()

test('headers', function()
local request = getInstance(
{ 'GET /Makefile?a=b&c=d HTTP/1.1', 'a: A', 'b: B', '', 'C=3', '' }
{ 'GET /Makefile?a=b&c=d&e=1&e=2 HTTP/1.1', 'a: A', 'b: B', 'c: X', 'c: Y', '', 'C=3', '' }
)

assert.are.same(
request:headers(),
{ ['a'] = 'A', ['b'] = 'B' }
request:headers(), {
a = 'A',
b = 'B',
c = { 'X', 'Y' },
}
)

assert.are.same(
request.querystring,
{ ['a'] = 'b', ['c'] = 'd' }
request.querystring, {
a = 'b',
c = 'd',
e = { '1', '2' },
}
)
end)

Expand Down

0 comments on commit 5111904

Please sign in to comment.