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

react native android method GET must not have a request body #597

Open
Singloo opened this issue Sep 19, 2018 · 0 comments
Open

react native android method GET must not have a request body #597

Singloo opened this issue Sep 19, 2018 · 0 comments

Comments

@Singloo
Copy link

Singloo commented Sep 19, 2018

1.app 在android上崩溃, method GET must not have a request body
react native版本 0.47.2
可能原因:
在realtime.js文件中下面这个方法,data默认是{}

 async _request({ method, version = '1.1', path, query, headers, data = {} }) {
    const { appId, server } = this._options;
    const { api } = await this.constructor._getServerUrls({
      appId,
      server,
    });
    const url = `https://${api}/${version}${path}`;
    const options = {
      method,
      params: query,
      headers: {
        'X-LC-Id': this._options.appId,
        'X-LC-Key': this._options.appKey,
        ...headers,
      },
      data,
    };
    debugRequest('Req: %O %O', url, options);
    return axios(url, options).then(
      response => {
        debugRequest('Res: %O %O %O', url, response.status, response.data);
        return response.data;
      },
      error => {
        debugRequest(
          'Error: %O %O %O',
          url,
          error.response.status,
          error.response.data
        );
        if (error.response && error.response.data && error.response.data.code) {
          throw createError(error.response.data);
        }
        throw error;
      }
    );
  }

2.RN打包的时候发现用的是.browser文件,而不是node,这是正常的吗?

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

1 participant