You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'{"page":5,"per_page":6,"total":12,"total_pages":2,"data":[],"support":{"url":"https://reqres.in/#support-heading","text":"To keep ReqRes free, contributions towards server costs are appreciated!"}}',
145
-
response.body
146
-
)
147
-
assert.same({
148
-
version="HTTP/2",
149
-
code=200,
150
-
text=""
151
-
}, response.status)
152
-
-- HACK: have no idea how to make sure it is table<string,string>
-- HACK: have no idea how to make sure it is table<string,string>
182
-
assert.are_table(response.headers)
183
-
end)
184
-
end)
130
+
---- don't run real request on test by default
131
+
--describe("curl cli request", function()
132
+
-- nio.tests.it("basic GET request", function()
133
+
-- local response = curl
134
+
-- .request({
135
+
-- context = Context:new(),
136
+
-- url = "https://reqres.in/api/users?page=5",
137
+
-- handlers = {},
138
+
-- headers = {},
139
+
-- cookies = {},
140
+
-- method = "GET",
141
+
-- })
142
+
-- .wait()
143
+
-- assert.same(
144
+
-- '{"page":5,"per_page":6,"total":12,"total_pages":2,"data":[],"support":{"url":"https://reqres.in/#support-heading","text":"To keep ReqRes free, contributions towards server costs are appreciated!"}}',
145
+
-- response.body
146
+
-- )
147
+
-- assert.same({
148
+
-- version = "HTTP/2",
149
+
-- code = 200,
150
+
-- text = ""
151
+
-- }, response.status)
152
+
-- -- HACK: have no idea how to make sure it is table<string,string>
153
+
-- assert.are_table(response.headers)
154
+
-- end)
155
+
-- nio.tests.it("basic POST request", function()
156
+
-- local response = curl
157
+
-- .request({
158
+
-- context = Context:new(),
159
+
-- url = "https://reqres.in/api/register",
160
+
-- handlers = {},
161
+
-- headers = {
162
+
-- ["content-type"] = { "application/json" }
163
+
-- },
164
+
-- cookies = {},
165
+
-- method = "POST",
166
+
-- body = {
167
+
-- __TYPE = "json",
168
+
-- data = '{ "email": "eve.holt@reqres.in", "password": "pistol" }',
169
+
-- }
170
+
-- })
171
+
-- .wait()
172
+
-- assert.same(
173
+
-- '{"id":4,"token":"QpwL5tke4Pnpja7X4"}',
174
+
-- response.body
175
+
-- )
176
+
-- assert.same({
177
+
-- version = "HTTP/2",
178
+
-- code = 200,
179
+
-- text = ""
180
+
-- }, response.status)
181
+
-- -- HACK: have no idea how to make sure it is table<string,string>
0 commit comments