我需要在我的 Laravel 应用程序中使用 Google Translate API,获取请求工作正常,但发布请求似乎没有,我尝试使用 Postman 并收到相同的错误消息。
这是我做的测试:
Route::get('/', function () {
return Http::withHeaders([
"content-type" => "application/x-www-form-urlencoded",
"accept-encoding"=> "application/gzip",
"x-rapidapi-key"=> "<rapid_api_key_here>",
"x-rapidapi-host"=> "google-translate1.p.rapidapi.com",
"useQueryString"=> true
])->post('https://google-translate1.p.rapidapi.com/language/translate/v2/detect', [
"q"=> "English is hard, but detectably so",
]);
});
这是我在两个测试中得到的错误:
不知道哪里出了问题,有什么建议吗?