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

相关推荐
星星码️2 天前
博客系统 Web 端测试报告:功能、自动化与性能
功能测试·测试工具·压力测试·模块测试·测试覆盖率
han68892 天前
selenium之实战
笔记·python·selenium·测试工具·自动化
Madison-No72 天前
多语言聊天大模型--测试报告
linux·git·python·selenium·jmeter·自动化·postman
.又是新的一天.2 天前
AI接口测试03(操作数据库/管理文档/mock/自动化测试/定时任务/AI导师)
软件测试·测试工具·接口测试·apifox
Wokoo72 天前
自动化测试入门:核心场景、回归测试与 Web 自动化环境搭建
java·开发语言·测试工具
德思特2 天前
德思特混频器参数详解:5MHz–40GHz 宽频段与低噪声 LO 设计
测试工具·自动化·射频工程
wuyk5553 天前
《WiFi 嵌入式物联网开发全套实战》| 第 33 章 Wireshark 无线抓包环境搭建、802.11 帧过滤规则
物联网·测试工具·wireshark
二喵❥(^_-)4 天前
接口测试流程的三个核心环节
开发语言·lua