Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

http.post.json not execute unless i put console.log(var) #34

Open
picsoung opened this issue Jan 6, 2015 · 1 comment
Open

http.post.json not execute unless i put console.log(var) #34

picsoung opened this issue Jan 6, 2015 · 1 comment

Comments

@picsoung
Copy link

picsoung commented Jan 6, 2015

Weird behavior I've just seen...

this won't do the post
local r = http.json.post(hookURL,'{"text": "'..msg..'","channel":"#'.. decoded_params.channel_name..'","icon_emoji":":cat:"}')

but this will do

local r = http.json.post(hookURL,'{"text": "'..msg..'","channel":"#'.. decoded_params.channel_name..'","icon_emoji":":cat:"}')

console.log(r)

on this middleware https://fdf2cfc6fadb.my.apitools.com/app/services/1/middlewares/bfadd6dd-6c82-446f-83ac-0e94ed4302a3

No idea why.

@mikz
Copy link
Contributor

mikz commented Jan 6, 2015

All http requests are asynchronous by default. So unless you do something with it (read status, body, ...) it won't wait for it to finish.

I'll check how hard it would be to register them somewhere and then wait for all of them to finish before passing to next middleware.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants