burggraf/SupaScript

Cannot use http post

josh4500 opened this issue · 2 comments

Http post doesn't work on application/json content-type. I tried converting the payload into the JSON string and it still doesn't work.
const res = http.post('https://supachat.herokuapp.com/', JSON.stringify(name: "Johnathan"), [], 'application/json' );

Do not send the payload as a string. Just send the actual JSON object and SupaScript will take care of encoding it for you. I think you're overthinking it here.

Do not send the payload as a string. Just send the actual JSON object and SupaScript will take care of encoding it for you. I think you're overthinking it here.

Yes it worked. Thanks a lot. You saved me from a nightmare