Hi I have endpoint
/upload/slide-image for uploading image to amazon s3.
After complete uploading I need to send response to client which is Reactjs.
def upload(conn, params) do
# uploading code
#send response to the client with amazon s3 image url
send_resp(conn, 200, image_url)
end
I am calling this controller in client side using fetch api
fetch(server_url, { method: "POST", body: data })
.then( response => console.log("Printing response: ", response);
but Response object in client is empty.
Response {
body: null
bodyUsed: false
headers: Headers {}
ok: false
redirected: false
status: 0
statusText: ""
type: "opaque"
url: ""
}
And In browser network tab, I can find image url in response tab, So my server sending response. But How can I send_resp for Response object in client side?