js-realtime-sdk icon indicating copy to clipboard operation
js-realtime-sdk copied to clipboard

react native android method GET must not have a request body

Open Singloo opened this issue 7 years ago • 0 comments

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,这是正常的吗?

Singloo avatar Sep 19 '18 07:09 Singloo