【发布时间】:2021-02-11 17:32:03
【问题描述】:
我需要在我的 Laravel 应用程序中使用 Google Translate API,get 请求工作正常,但 post 请求似乎没有,我尝试使用 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",
]);
});
这是我在两次测试中遇到的错误:
不知道哪里出了问题,有什么建议吗?
【问题讨论】:
标签: laravel api post postman rapidapi