Skip to content

Instantly share code, notes, and snippets.

@Rukenshia
Last active August 19, 2017 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rukenshia/9688dca4d3af63188ae45185f1a65f4d to your computer and use it in GitHub Desktop.
Save Rukenshia/9688dca4d3af63188ae45185f1a65f4d to your computer and use it in GitHub Desktop.
Webhook Issue
defmodule Luggas do
use Plug.Router
plug Plug.Logger, log: :debug
plug Plug.Parsers, parsers: [:json],
pass: ["text/*"],
json_decoder: Poison
plug :match
plug :dispatch
post "/webhook" do
# curl -X POST -H 'Content-Type: application/json' -d '{"foo": "bar"}' localhost:4000/webhook
# curl output: none, status code 500
# log: 15:57:36.818 [debug] POST /_telegram
# no "Sent in" log message
IO.puts "at least I'm getting called"
send_resp(conn, 200, "???")
end
match _ do
send_resp(conn, 400, "hi")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment