Skip to content

Commit de611a0

Browse files
committed
Merge pull request #19 from ignacio/patch-2
Set querystring also for POST requests
2 parents bb69bde + 6515db0 commit de611a0

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/wsapi/mock.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ local function build_post(path, params, headers)
118118
req.CONTENT_TYPE = "x-www-form-urlencoded"
119119
end
120120

121+
-- if the path includes a query string, store it in the appropiate header
122+
local qs = path:match("?(.+)$")
123+
if qs then
124+
req.QUERY_STRING = qs
125+
end
126+
121127
req.CONTENT_LENGTH = #body
122128

123129
return {
@@ -155,4 +161,4 @@ function _M.make_handler(app)
155161
}
156162
end
157163

158-
return _M
164+
return _M

0 commit comments

Comments
 (0)