Skip to content

Instantly share code, notes, and snippets.

@avaitla
Last active March 25, 2021 17:27
Show Gist options
  • Save avaitla/0d6fc2e1ee7a01325cda8e0e5dd28bae to your computer and use it in GitHub Desktop.
Save avaitla/0d6fc2e1ee7a01325cda8e0e5dd28bae to your computer and use it in GitHub Desktop.
Debugging Elixir
This curl and HTTPPoison work but are different than mojito which doesn't work:
$ curl -XPOST -H 'Content-Type: application/json' -d '{"http_dest_path":"HELLO HELLO"}' 'https://sheet.best/api/sheets/8c605252-578d-4ec3-abe3-7ceff87a7cb8' -v
Response is: [{"http_dest_path":"HELLO HELLO","payload":"","token":""}]
[socket#4] event: data
--> POST / HTTP/1.1
--> Host: localhost:8081
--> User-Agent: curl/7.64.1
--> Accept: */*
--> Content-Type: application/json
--> Content-Length: 32
-->
--> {"http_dest_path":"HELLO HELLO"}
$ HTTPoison.post("https://sheet.best/api/sheets/8c605252-578d-4ec3-abe3-7ceff87a7cb8", "{\"http_dest_path\":\"HELLO HELLO\"}", %{"Content-Type" => "application/json"})
Response works: [{"http_dest_path":"HELLO HELLO","payload":"","token":""}]
[socket#1] event: data
--> POST / HTTP/1.1
--> Host: localhost:8081
--> User-Agent: hackney/1.17.0
--> Content-Type: application/json
--> Content-Length: 32
-->
--> {"http_dest_path":"HELLO HELLO"}
$ Mojito.post("https://sheet.best/api/sheets/8c605252-578d-4ec3-abe3-7ceff87a7cb8", [{"Content-Type", "application/json"}], "{\"http_dest_path\":\"HELLO HELLO\"}")
Response is (missing the http_dest_path): [{"http_dest_path":"","payload":"","token":""}]
[socket#2] event: data
--> POST / HTTP/1.1
--> transfer-encoding: chunked
--> host: localhost:8081
--> user-agent: mint/1.2.0
--> content-type: application/json
-->
--> 20
--> {"http_dest_path":"HELLO HELLO"}
--> 0
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment