簡體   English   中英

獲取錯誤 - 使用 POST 時不允許接收 405 GET 方法

[英]Fetch error - Receiving 405 GET Method Not Allowed While Using POST

我正在嘗試部署一個應用程序,我必須在其中注冊才能從后端獲取帶有我的數據( usernameemailpassword )的 JSON。 我通過 fetch 將前端鏈接到后端(代碼已附加)。 我的 fetch 請求有一個 POST 方法,但是我得到了這個錯誤,而我沒有使用任何 GET 方法,為什么會這樣?

 fetch('link/signup' /*will be changed with correct URL tomorrow*/,{ method: 'POST', /* method: 'POST', body: formData, */ headers: { "Content-Type": "application/json", }, body: JSON.stringify({ username: username.value, email: email.value, password: password.value, }), }).then((response) => { return response.json(); }).catch((error) => { console.log('Request failed', error); });

GET https://link/signup/ 405(方法不允許)(匿名)@registration.9bbdb929a0502d2a723f.js:68

這很奇怪,但有些 API 不區分大小寫。 嘗試寫 'post' 而不是 'POST' 看看

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM