国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

vue調(diào)用delete的接口后,再調(diào)用列表post接口,返回400 Bad Request

康康

問題描述

后臺單個列表,點擊刪除按鈕之后調(diào)用webman寫的接口,delete請求方式,然后接口返回成功,成功后前端新請求列表接口并刷新列表,請求的列表接口報 400 Bad Request

程序代碼

      // 刪除模版
      deleteTemp(item) {
        this.$confirm('此操作將刪除該模版, 是否繼續(xù)?', '提示', {
          confirmButtonText: '確定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http.delete(`/api/report/template/${item.template_no}`).then(
            response => {
              let res = response.body;
              if (res.error_code === 0) {
                this.isLoading = false;
                this.$notify({
                  title: "刪除成功",
                  message: res.message,
                  type: "success",
                  duration: 1000
                });
                this.onChangePage();
              } else {
                this.isLoading = false;
                this.$notify({
                  title: "提示",
                  message: res.message,
                  type: "warning",
                  duration: 1000
                });
              }
            },
            response => {
              response &&
                this.$notify({
                  title: "提示",
                  message: response,
                  type: "error",
                  duration: 1000
                });
            }
          );
        }).catch((err) => {});
      },

在onChangePage方法中會調(diào)用列表接口, 使用的 this.$http.post 接口返回了400

報錯信息

400 Bad Request
發(fā)現(xiàn)把刪除的接口換成非delete(如使用post或者get)之后就沒問題了,但delete之后的請求會400,但刷新單獨請求列表就能正常響應(yīng)。把delete請求發(fā)送到其他服務(wù)上驗證,也是沒有問題的。
正常的返回:
截圖

截圖報錯信息里報錯文件相關(guān)代碼

截圖

操作系統(tǒng)及workerman/webman等框架組件具體版本

openresty/1.21.4.1
Webman-framework v1.4.7
PHP 7.4.30

1340 1 0
1個回答

walkor 打賞

可能是你的delete請求不符合HTTP協(xié)議,比如delete請求包含了body。
升級workerman試下,新版workerman對delete帶body的情況作了兼容

  • 康康 2023-03-30

    好,關(guān)鍵是delete請求是正常的,但后續(xù)的post請求失敗了。

  • walkor 2023-03-30

    正常delete不會有body,所以body不會被讀取仍然留在socket緩沖區(qū),下次請求會把這個body當(dāng)作http頭,所以報錯400

年代過于久遠(yuǎn),無法發(fā)表回答
??