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

相关推荐
Tinyfacture12 小时前
postman抓取登录鉴权码token及设置全局变量
测试工具·postman
玖玥拾17 小时前
Lua 基础语法(八) Unity Huatuo (HybridCLR)
开发语言·unity·游戏引擎·lua
川石课堂软件测试17 小时前
涨薪技术|Prometheus之HTTP API中使用PromQL
网络协议·测试工具·jmeter·http·单元测试·postman·prometheus
x10n91 天前
Postman 汉化完整指南
测试工具·lua·postman
AI情绪识别开源2 天前
检信 Allemotion 认知功能障碍矫正软件体验评审意见报告
lua
Luminbox紫创测控2 天前
一文读懂:准直太阳模拟器如何检测汽车AR-HUD阳光倒灌
测试工具·汽车·ar·安全性测试·太阳光模拟器·测试标准·阳光倒灌
程序员小远3 天前
自动化测试用例编写实例详解
自动化测试·软件测试·python·selenium·测试工具·职场和发展·测试用例
云雀衔光3 天前
Java Spring AI MCP:在 Spring 里把 AI 接上你的业务系统
java·开发语言·人工智能·后端·测试工具·spring
云雀衔光3 天前
MCP + 应用生成:让 AI 直接产出可交互的应用
java·人工智能·测试工具·microsoft·交互·ai编程