openresty / echo-nginx-module

An Nginx module for bringing the power of "echo", "sleep", "time" and more to Nginx's config file
http://wiki.nginx.org/NginxHttpEchoModule
BSD 2-Clause "Simplified" License
1.17k stars 254 forks source link

echo_foreach_split join delimiter #84

Closed kapcod closed 5 years ago

kapcod commented 5 years ago

I'm trying to use echo_foreach_split and echo_location_async to merge few single JSON requests into one JSON array. The problem is that I can't find how to join all the responses with a comma. Adding echo ','; to the loop doesn't help, as having extra comma at the end breaks JSON syntax.

Any way to do it? I could use lua, probably, but echo_foreach_split seemed like an ideal fit.

agentzh commented 5 years ago

@crazyshot Yes, more complex things should go the Lua route.