PROGRADE-Tech / Tarchivebot

:page_with_curl: Telegram chat message archive and statistics
https://tarchive.neat.moe
GNU Affero General Public License v3.0
10 stars 4 forks source link

API Crash on post with JSON data #25

Closed Hoi15A closed 7 years ago

Hoi15A commented 7 years ago

In the current version of the API, when sending a post request with (what I think counts as non form-encoded data, but I'm not sure) say JSON data.

For example: curl -d '{"kek":12, "notkek":2}' http://localhost:3000/api/recent would cause the API to crash the whole node process.

fuerbringer commented 7 years ago

Fixed in 6b876bd API now accepts JSON instead of form-encoded data. This is a new, valid request: curl -d '{"key":"96329bfe27ad3bfdf059156999860739eb5389940a58e8c7964076b270ccb7d4","amount":2}' -H 'Content-Type: application/json' http://localhost:3000/api/recent

23

Hoi15A commented 7 years ago

Yup, switching to json seems to have fixed this. Ill close this issue for now