API POST that works on Postman not working on Appsmith

I’m trying to make a POST call to a local server on my network. The call I am trying works fine when executed from Postman, but I am not having luck when doing it from an Appsmith App hosted on the same network. I’ve tried to match the settings from Postman exactly in the API call config on Appsmith. Appsmith errors out immediately saying “Connection prematurely closed BEFORE response.”

Taking a PCAP on the local server that is hosting the API, I see that both POST calls are getting there. I am seeing in Wireshark that the Postman traffic is showing the encapsulated MIME multipart media, but the Appsmith call is not (see screenshot). I have PCAPs that I can share through DM if needed. Any ideas?

I’ve reach out to the developer of the software hosting the API for feedback. He said:

unfortunately it seems to be incompatibility between Script server and Appsmith.
Script server expects the following header:
'content-type: multipart/form-data; boundary=----WebKitFormBoundaryzEGlClez0qGU5zD8'

and the data structure like this
'------WebKitFormBoundaryzEGlClez0qGU5zD8\r\nContent-Disposition: form-data; name="operand 1"\r\n\r\n1\r\n

(boundary token would be different for every session/browser, but it’s important that it matches the token in the data field).
For whatever reason, this structure is different for Appsmith. Is there any way to debug a raw request, which is sent by Appsmith?

Looks like I may have hit a wall. Need to have a header like this:
'content-type: multipart/form-data; boundary=----WebKitFormBoundaryzEGlClez0qGU5zD8'

while composing a raw body that looks like this:

------WebKitFormBoundaryo4HY2qwFibq79miB
Content-Disposition: form-data; name="__script_name"

test
------WebKitFormBoundaryo4HY2qwFibq79miB--

Doesn’t seem to be possible.

Hi Trebuchet,

Would you be able to share packet capture file over DM please?

Hi @sidhant - sending now.

@sidhant can you please summarize the solution here?