Critical Stitch Function Bug (context.http.post)

I believe that theres a bug in the context.http.post library.

When you try to post with form data
response = await context.http.post({

  • ‘url’: ‘https://postman-echo.com/post’,*
  • ‘form’: {‘username’:‘test’,‘password’:‘test’,‘grant_type’:‘test’},*
  • ‘headers’: {‘Content-Type’: [ “application/x-www-form-urlencoded” ] },*
  • });*

The post add’s additional information into the form and json fields.
“form”: {

  • “–59295b763be03d70bc12ca2b8e5ed6b469c0ce41f65dc4cbdea89e394a52\r\nContent-Disposition: form-data; name”: “"username"\r\n\r\ntest\r\n–59295b763be03d70bc12ca2b8e5ed6b469c0ce41f65dc4cbdea89e394a52\r\nContent-Disposition: form-data; name="password"\r\n\r\ntest\r\n–59295b763be03d70bc12ca2b8e5ed6b469c0ce41f65dc4cbdea89e394a52\r\nContent-Disposition: form-data; name="grant_type"\r\n\r\ntest\r\n–59295b763be03d70bc12ca2b8e5ed6b469c0ce41f65dc4cbdea89e394a52–\r\n”*
  • },*

This explains why when you add the multipart/form-data header, the response is
{“message”:“invalid character ‘I’ looking for beginning of value”}

Hi Chi – We’ll take a look into this, in the meantime you may want to use a library to make HTTP requests such as Axios or Node’s HTTPS library.