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

Blank data #59

Closed
vanso-murlidhar opened this issue Apr 24, 2020 · 20 comments
Closed

Blank data #59

vanso-murlidhar opened this issue Apr 24, 2020 · 20 comments

Comments

@vanso-murlidhar
Copy link

vanso-murlidhar commented Apr 24, 2020

In android, request data is passing as blank for react version 0.61.5

@MaxToyberman
Copy link
Owner

Can you show me the request ?

@vanso-murlidhar
Copy link
Author

vanso-murlidhar commented Apr 27, 2020

Let data={
deviceID:7c144ed4769058e7
}


getRequestForm = data => {
  const sep = "=";
  let dataStr = "";

  Object.keys(data).map(key => {
    dataStr +=
      dataStr == "" ? key + sep + data[key] : "&" + key + sep + data[key];
  });
  return dataStr;
};


 response = await fetch(featureURL, {
        method: ‘POST’,
        headers: ‘Content-Type: "application/x-www-form-urlencoded", Cache-Control: "no-cache", client_id: "tPYQ0YJCeN8QsYS3c/lRweuNjwi0yYtrNeDhBrE=", deviceID: "7c144ed4769058e7", appVersion: "2.0.10’,
        sslPinning: {
          certs: ["cert1", "cert2"] // your certificates name (without extension), for example cert1.cer, cert2.cer
        },
        body: getRequestForm(requestData)
      });

IOS is working proplery. Only issue is with android.

Do i need to add any kind of okhttp3 support?

@MaxToyberman
Copy link
Owner

@vanso-murlidhar why headers is not an object ? and client_id, appversion should be inside also

@vanso-murlidhar
Copy link
Author

it is actually

var header = {
'Content-Type': 'application/x-www-form-urlencoded',
'Cache-Control': 'no-cache',
'client_id': clientID,
'deviceID': DEVICE.id,
appVersion: APP_VERSION
};

@MaxToyberman so headers are proper

@MaxToyberman
Copy link
Owner

@vanso-murlidhar how do you know that request data is blank ?

@vanso-murlidhar
Copy link
Author

vanso-murlidhar commented Apr 28, 2020

backend developer getting it as empty object @MaxToyberman . Not even data key in it

@MaxToyberman
Copy link
Owner

@vanso-murlidhar please search the logcat to see the request

@vanso-murlidhar
Copy link
Author

@vanso-murlidhar please search the logcat to see the request

Getting data with and without ssl in logcat

@MaxToyberman
Copy link
Owner

@vanso-murlidhar can you show me the output ?

@MaxToyberman
Copy link
Owner

@vanso-murlidhar , need to debug the native code, will need the full request for this, if it is possible.

@vanso-murlidhar
Copy link
Author

@vanso-murlidhar , need to debug the native code, will need the full request for this, if it is possible.

@MaxToyberman mailed on your email id

@MaxToyberman
Copy link
Owner

@vanso-murlidhar , in the logs i can see that it is in the body

@vanso-murlidhar
Copy link
Author

@vanso-murlidhar , in the logs i can see that it is in the body

I have attached 2 logs. One is with ssl plugin and one is react native fetch. Request must be changing for ssl fetch . I guess some changes are needed in plugin for react native version 0.61.5

@MaxToyberman
Copy link
Owner

@vanso-murlidhar i am also using 0.61.5 works good

@vanso-murlidhar
Copy link
Author

vanso-murlidhar commented May 3, 2020

@vanso-murlidhar i am also using 0.61.5 works good

My request without plugin is working but with plugin not. you can also see from sent logs data is empty

@vanso-murlidhar
Copy link
Author

vanso-murlidhar commented May 6, 2020

@MaxToyberman I debugged further and got the following diffrence

Headers should be which I am passing through code as you can see from logs

Content-Type': 'application/x-www-form-urlencoded'

But it is passing as

Content-Type=application/json; charset=utf-8

@MaxToyberman
Copy link
Owner

@vanso-murlidhar you are right, i found the issue

@MaxToyberman
Copy link
Owner

MaxToyberman commented May 8, 2020

@vanso-murlidhar new fixed version was released version: 1.4.4

please let me know if it works

@vanso-murlidhar
Copy link
Author

Thank you so much @MaxToyberman !!!! . It is working properly.

@MaxToyberman
Copy link
Owner

@vanso-murlidhar great !!

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