Nativescript: nativescript-background-http serverResponse is null

Created on 10 May 2017  路  4Comments  路  Source: NativeScript/NativeScript

plugins version:

 "tns-android": {
      "version": "2.5.0"
    }

"nativescript-background-http": "^3.0.0",

java
```java
@RequestMapping(value = "/appUploadImage",method= RequestMethod.POST)
public List appUploadImage(HttpServletRequest request,HttpServletResponse response) throws IOException {
InputStream inputStream = request.getInputStream();
UploadFileVo uploadFileVo = uploadService.saveFile(inputStream);
return Lang.list(uploadFileVo);
}

the upload is success,but can't get the return value

I want to get the return value `Lang.list(uploadFileVo)`


js
 ```javascript
task.on("complete", function(e,response){
        console.log('response')
        console.dump(response)
    });

response is null,

question

Most helpful comment

@NickIliev One thing I have been doing with any plugins that have been upgraded is listing in the docs what the last version that is compatible with 2.5.x is. This way it is easy for the end user to copy the tns plugin add [email protected] right from the docs and makes it less likely I'm dealing with support issues because of 2 vs 3 compatibility.

All 4 comments

@giscafer the issue is related to incompatible versions of the used plugin and NativeScript

nativescript-background-http 3.x.x and above will work with NativeScript 3.x.x and above.

If you want to use background-http with NativeScript 2.5.x then use a compatible version.
To see all published versions use the following:

npm view nativescript-background-http versions

and then you can install the wanted version with

tns plugin add [email protected]

or just revise your package.json, delete node_modules and rerun npm install

thks , i just found the solution

event responded ,not complete

  task.on("responded", function(e){
        console.log('responded')
        console.log(e.data);//the data is backend return value
    });

@NickIliev One thing I have been doing with any plugins that have been upgraded is listing in the docs what the last version that is compatible with 2.5.x is. This way it is easy for the end user to copy the tns plugin add [email protected] right from the docs and makes it less likely I'm dealing with support issues because of 2 vs 3 compatibility.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

valentinstoychev picture valentinstoychev  路  3Comments

nirsalon picture nirsalon  路  3Comments

fmmsilva picture fmmsilva  路  3Comments

guillaume-roy picture guillaume-roy  路  3Comments

hshristov picture hshristov  路  3Comments