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

相关推荐
猿小路16 小时前
抓包工具-Wireshark
网络·测试工具·wireshark
智航GIS16 小时前
10.4 Selenium:Web 自动化测试框架
前端·python·selenium·测试工具
廖圣平18 小时前
从零开始,福袋直播间脚本研究【三】《多进程执行selenium》
python·selenium·测试工具
合兴软件@1 天前
芯片适配快讯:合兴软件ISDT成功适配英飞凌TC3/TC4系列MCU
测试工具·车载系统·嵌入式实时数据库
Wpa.wk1 天前
性能测试-初识性能测试基础(性能测试流程,计划等)
java·运维·经验分享·测试工具·性能测试
我想吃烤肉肉1 天前
Playwright中page.locator和Selenium中find_element区别
爬虫·python·测试工具·自动化
测试19981 天前
Web自动化测试入门
自动化测试·软件测试·python·功能测试·selenium·测试工具·测试用例
食咗未1 天前
Linux tcpdump工具的使用
linux·服务器·网络·驱动开发·tcp/ip·测试工具·tcpdump
张永清-老清1 天前
每周读书与学习->JMeter性能测试脚本编写实战(三)如何利用JMeter为MySQL数据库构造测试数据
数据库·测试工具·jmeter·压力测试·性能调优·jmeter性能测试·每周读书与学习