Skip to content

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

@Singloo

Description

@Singloo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions