Accept simple destination field in bridge
This commit is contained in:
@@ -68,7 +68,8 @@ public final class ExternalBridgeHandler implements HttpHandler {
|
|||||||
private void enviarMensagem(HttpExchange ex, long empresaId) throws Exception {
|
private void enviarMensagem(HttpExchange ex, long empresaId) throws Exception {
|
||||||
Map<String,String> b = SimpleJson.parseObject(rawBody(ex));
|
Map<String,String> b = SimpleJson.parseObject(rawBody(ex));
|
||||||
String mensagem = required(b, "mensagem");
|
String mensagem = required(b, "mensagem");
|
||||||
String destinatariosRaw = required(b, "destinatarios");
|
String destinatariosRaw = firstNonBlank(b.get("destinatarios"), b.get("para"), b.get("destino"));
|
||||||
|
if (destinatariosRaw.isBlank()) throw new IllegalArgumentException("Campo obrigatorio: destinatarios ou para");
|
||||||
ApiKeyConfig cfg = apiKeyConfig(ex.getRequestHeaders().getFirst("X-API-Key"), empresaId);
|
ApiKeyConfig cfg = apiKeyConfig(ex.getRequestHeaders().getFirst("X-API-Key"), empresaId);
|
||||||
Map<String,Object> inst = evolutionAprovada(empresaId);
|
Map<String,Object> inst = evolutionAprovada(empresaId);
|
||||||
if (inst == null) {
|
if (inst == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user