-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POST formData with executeHttpRequest #2450
Comments
As it works with fetch, I tried to do the same via axios directly.
|
@nocin The two issues you linked in your comment seem to be resolved now. Is this sill an issue for you? |
Hi Cloud SDK Team,
Describe the bug
I already posted a question in the CAP Forum a few months ago which explains what I'm trying to archive and also what I tried so far.
https://answers.sap.com/questions/13551972/posting-formdata-to-external-rest-api.html
I have an API which I try to post a file to using formData. I can successfully use the API via Postman or using fetch.
Then I tried the same using CDS and now also directly using executeHttpRequest.
To Reproduce
Unfortunately I have no public API which I can provide for testing.
Expected behavior
Of course the API should accept my formData query send via executeHttpRequest. :-)
The API Endpoint converts the file and the content-type of the response is for example:
Content-Type: multipart/mixed;boundary=Boundary_682_1571866230_1651741380254
As already said, this works fine using fetch (see my posted question) and the problem seems to be on the sending side.
Used Versions:
node -v
v14.17.6
npm -v
6.14.15
1.54.0
Code Examples
Using CDS:
Using executeHttpRequest:
Tried adding different headers, without success.
One thing to note, using Postman the Content-Type always includes the boundary, e.g.:
Content-Type: multipart/form-data; boundary=--------------------------817648025188283885837797
I tried adding it manually while debugging, but also no success.
Log file
Error message always returned: "Request failed with status code 404"
From wiki:
It defnitly can reach the API enpoint as it returns a Payara error message (the endpoint service runs on a Payara Server):
Unfortunaltely until now I didn't had the chance to check on Payara server side, if anything and what exacly arrives at the endpoint. It seems that the request is not correct when send to the endpoint.
best regads
Nico
The text was updated successfully, but these errors were encountered: