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 小时前
用python实现postman
开发语言·python·postman
hbugs0011 天前
BPF 表达式检查器:一款免费开源的 Wireshark 捕获过滤器语法检查与可视化构建工具
网络·测试工具·开源·eve-ng·bpf
测试秃头怪2 天前
如何评估自动化测试脚本的编写时间和维护工作量?
自动化测试·软件测试·python·功能测试·测试工具·职场和发展·测试用例
啦啦啦!2 天前
AI接口自动化测试的学习
学习·postman
程序员杰哥2 天前
接口测试知识总结
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·接口测试
尼古拉斯·纯情暖男·天真·阿玮2 天前
正交表的概念与生成
测试工具
城中南小2 天前
人机Agent团队协同:从Managed Agents原理到Multica实践
selenium·测试工具
测试老哥3 天前
Pytest自动化测试详解
自动化测试·软件测试·python·测试工具·测试用例·pytest·接口测试
Luminbox紫创测控3 天前
大面积太阳模拟器设计原理与高均匀度辐照实现方法
人工智能·测试工具·安全性测试·测试标准
m0_752035633 天前
postman重新安装后历史接口数据不见了
测试工具·postman