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

相关推荐
网络安全-老纪4 小时前
一文2000字手把手教你自动化测试Selenium+pytest+数据驱动
自动化测试·软件测试·selenium·测试工具·pytest
可可南木8 小时前
3070文件格式--17--设备文件
功能测试·测试工具·pcb工艺
weixin_4407305010 小时前
05接口测试-01接口理论+02posman的使用
功能测试·测试工具·postman
钟智强15 小时前
CVE-2025-49844高危预警:Redis Lua脚本引擎UAF漏洞深度剖析与POC实战
数据库·redis·web安全·junit·lua
我的xiaodoujiao15 小时前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 51--CI/CD 4--推送本地代码到Git远程仓库
python·学习·测试工具·ci/cd·pytest
闲人编程16 小时前
聚合管道与复杂查询
开发语言·oracle·lua·match·查询·聚合·lookup
派大星-?2 天前
自动化测试五模块一框架(上)
开发语言·python·测试工具·单元测试·可用性测试
会周易的程序员2 天前
cNetgate物联网网关内存数据表和数据视图模块架构
c语言·c++·物联网·架构·lua·iot
为你奋斗!3 天前
在 Windows 上部署 Dify
测试工具