在React Native中发布参数时使用rn-fetch-blob无法下载mp3文件

时间:2020-07-22 12:10:39

标签: react-native react-android rn-fetch-blob

我正在尝试使用rn-fetch-blob下载mp3文件,但未在api请求中接收发布道具。

请找到以下代码:

.fetch(
          'POST',
          'https://us-central1-app-tts-e**ne.cloudfunctions.net/**/*****',
            {
              text: text.text,
              voice: voice,
            }
         )
        .then((res) => {
          // the temp file path
          console.warn('The file saved to ', res.path());
        });
    } catch (err) {
      console.log(err);
    }

我遇到错误

{"message":"There were 2 validation errors:\n* MissingRequiredParameter: Missing required key 'Text' in params\n* MissingRequiredParameter: Missing required key 'VoiceId' in params","code":"MultipleValidationErrors","errors":[{"message":"Missing required key 'Text' in params","code":"MissingRequiredParameter","time":"2020-07-22T11:59:05.351Z"},{"message":"Missing required key 'VoiceId' in params","code":"MissingRequiredParameter","time":"2020-07-22T11:59:05.351Z"}],"time":"2020-07-22T11:59:05.351Z"}

任何人都可以告诉我如何传递道具rn-fetch-blob,这将是很大的帮助:)

0 个答案:

没有答案