NativeScript / nativescript-background-http

Background Upload plugin for the NativeScript framework
Apache License 2.0
102 stars 50 forks source link

Request not received on server #212

Closed JuanDeLeon closed 5 years ago

JuanDeLeon commented 5 years ago

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

I'm trying to upload an image to my server using the following code. fileUri contains the path to the image.

var request = {
         url: "https://example.com/receiveImage",
         method: "POST",
         headers: {
                    "Content-Type": "application/octet-stream"
         },
         description: "{ 'uploading': " + name + " }"
};

var task = session.uploadFile(fileUri, request);

I can see the following logs, assuming the method worked. However, in my server there is no request being received at all. (I used Postman to make sure my route is active, so the problem is not there).

Any ideas of what could be wrong? Thanks in advance.

CONSOLE LOG file:///app/bundle.js:2557:20: 'currentBytes: 8192'
CONSOLE LOG file:///app/bundle.js:2558:20: 'totalBytes: 5188234'
CONSOLE LOG file:///app/bundle.js:2559:20: 'eventName: progress'
<nw_activity 12:3 [4FF2F4E5-1883-4027-9260-779A19FD4842] (reporting strategy default) complete (reason success)> complete with reason 2 (success), duration 686ms
CONSOLE LOG file:///app/bundle.js:2557:20: 'currentBytes: undefined'
CONSOLE LOG file:///app/bundle.js:2558:20: 'totalBytes: undefined'
CONSOLE LOG file:///app/bundle.js:2559:20: 'eventName: progress'
CONSOLE LOG file:///app/bundle.js:2557:20: 'currentBytes: undefined'
CONSOLE LOG file:///app/bundle.js:2558:20: 'totalBytes: undefined'
CONSOLE LOG file:///app/bundle.js:2559:20: 'eventName: complete'
JuanDeLeon commented 5 years ago

Seems like the image was too big. It worked for other images below 1MB.