Wappler’s Server Action API Module Always Adds 'application' Prefix to Content-Type

Wappler Version : 7.4.2
Operating System : Win 11
Server Model: NodeJS
Database Type: MariaDB
Hosting Type: Dedicated Windows Server

Expected behavior

What do you think should happen?

Sending an image from a client side form ($POST) to ChatGPT API endpoint to allow it to be edited should result in correct info coming back

Actual behavior

What actually happens?

Error is thrown: 'Unsupported content type: 'application/multipart/form-data'. This API method only accepts 'multipart/form-data' requests, but you specified the header 'Content-Type: application/multipart/form-data'. Please try again with a supported content type

The problem is Wappler is prefixing application to the Content-Type header, this causes an API error with chatgpt endpoint https://api.openai.com/v1/images/edits

The endpoint expects: Content-Type: multipart/form-data but Wappler is sending Content-Type: application/multipart/form-data

How to reproduce

  • create an upload form to upload an image
  • set up an API to point the image to the chatgpt endpoint `https://api.openai.com/v1/images/edits`
  • Try to upload an image, error above is triggered for the reason stated

I can supply the full json file I’m using if you’d like to test it.

Are you trying to send a file via Server Connect API?

I could be wrong, but I think it's not possible, there's a afeature request and some extension for that:

Yes I’m trying to send an image to ChatGPT API. I’m a bit surprised Wappler still can’t do this natively tbh.

really appreciate your help, I’ll try out your suggestion as soon as I’ve finished my morning coffee infusion :slight_smile:

I will look if i can add that to my All AI extension if that will help? No promises but will look into it.

1 Like

That would be amazing Brian, the multi AI one you did has been working faultlessly. It’d be fab if it could also deal with files/inages

Just about to release new version (today) which supports GPT 5 correctly.
Will look at adding image upload over the break.

1 Like

I’ll be checking on during the break so let me know if you need anything and I’ll get right back to you. All the best to you and Debi for the festivities, hope you both have a great time.