Skip to content
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

Use uploadFile , but the response without data #136

Open
TLideaCreator opened this issue Apr 18, 2017 · 2 comments
Open

Use uploadFile , but the response without data #136

TLideaCreator opened this issue Apr 18, 2017 · 2 comments

Comments

@TLideaCreator
Copy link

TLideaCreator commented Apr 18, 2017

this.httpNative.uploadFile(ApiUrl.addAvatar,
      {token: DataProvider.getData<User>(DataProvider.USER_KEY).token},
      {}, filePath, "avatar")
      .then(response => {
        console.log("response is "+JSON.stringify(response));
      })
      .catch(error => {
        this.faultError(faultHandler, ErrorCode.ERROR);
      });

the response is

{
    "status": 200,
    "headers":
    {
        "Access-Control-Allow-Credentials": "true",
        "Content-Type": "text/html; charset=UTF-8",
        "Access-Control-Max-Age": "86400",
        "Access-Control-Allow-Methods": "POST, PATCH, GET, OPTIONS, PUT, DELETE",
        "X-Powered-By": "PHP/7.0.15",
        "Access-Control-Allow-Origin": "*",
        "Date": "Tue, 18 Apr 2017 05:09:47 GMT",
        "Host": "localhost:9000",
        "Access-Control-Allow-Headers": "Content-Type, Authorization, X-Requested-With",
        "Cache-Control": "no-cache",
        "Connection": "close"
    }
}

the response is with out data , do I lost some config?
plugin version is 1.2.0
My system information:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v7.5.0
Xcode version: Xcode 8.3.1 Build version 8E1000a

@galikaixin
Copy link

the same with me, i also get without data

@galikaixin
Copy link

find the file:CordovaHttpPlugin.m
line:178 add the code:
[dictionary setObject:responseObject forKey:@"data"];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants