We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa63525 commit d40f5ceCopy full SHA for d40f5ce
lua/plenary/curl.lua
@@ -252,10 +252,14 @@ local request = function(specs)
252
return args
253
end
254
255
- local job = J:new {
+ local job_opts = {
256
command = "curl",
257
args = args,
258
- on_exit = function(j, code)
+ }
259
+ if opts.stream then
260
+ job_opts.on_stdout = opts.stream
261
+ else
262
+ job_opts.on_exit = function(j, code)
263
if code ~= 0 then
264
error(
265
string.format(
@@ -273,10 +277,11 @@ local request = function(specs)
273
277
else
274
278
response = output
275
279
276
- end,
- }
280
+ end
281
282
+ local job = J:new(job_opts)
283
- if opts.callback then
284
+ if opts.callback or opts.stream then
285
return job:start()
286
287
local timeout = opts.timeout or 10000
0 commit comments