fetch使用put请求提交文件,postman使用put请求提交文件

javascript 复制代码
import { createFetch } from "@vueuse/core";
       


         // 上传
        const useMyFetch = createFetch({
          options: {
            async beforeFetch({ options }) {
              options.method = "PUT";
              options.headers = {
                ...options.headers,
                "Content-Type": req.file.type
              };
              return { options };
            }
          }
        });
        const { error } = await useMyFetch(host).put(req.file).text();

        if (error.value) {
          ElMessage.error("文件上传失败");
          item.error = error.value.message;
          emit("error", item);
          return reject(error);
        }

人工智能学习网站

https://chat.xutongbao.top

相关推荐
介一安全6 小时前
BurpSuite 插件 Log4j2Scan 使用和手动验证
测试工具·log4j·安全性测试
观音山保我别报错2 天前
抽奖项目-接口自动化测试
功能测试·测试工具·单元测试
我的xiaodoujiao2 天前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 48--本地环境部署Jenkins服务
python·学习·测试工具·pytest
我的xiaodoujiao2 天前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 49--CI/CD-开始探索使用Jenkins
python·学习·测试工具·ci/cd·jenkins·pytest
学习3人组2 天前
Win11 使用 Proxifier 强制本地流量通过 Fiddler Classic 代理指南
前端·测试工具·fiddler
少云清2 天前
【UI自动化测试】2_web自动化测试 _Selenium环境搭建(重点)
前端·selenium·测试工具·web自动化测试
少云清2 天前
【UI自动化测试】1_web自动化测试 _测试工具选择
测试工具·web自动化测试
小妖6662 天前
有替代postman的软件吗
测试工具·postman
御坂10101号3 天前
Google Ads 转化凭空消失?问题藏在同意横幅的「时机」
前端·javascript·测试工具·网络安全·chrome devtools
德思特3 天前
德思特方案 | 突破户外测试局限:德思特GNSS仿真方案赋能机器人高精定位
经验分享·测试工具·信息与通信·电子测量仪器