Search code examples
amp-html

AMP - POST with `content-type: application/json`


The problem

Is it possible to send a POST request with Content-Type: application/json on AMP applications?

More context

I have a form on my App and I need to perform a POST request on my API with Content-type: application/json. I've checked the amp-form component in order to do it, but I've noticed that it sends a request with the header content-type: multipart/form-data; boundary=----WebKitFormBoundaryoYJsC0JKaBczGL1z as you may see here.

enter image description here

So, is it possible to change this to application/json or the API needs to handle the content-type: multipart/form-data; requests as well?


Solution

  • I think you need the API to handle it. The fetch event seems to always going to have multipart/form-data.

    Regards,