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

相关推荐
MYians19 小时前
[Windows]Postman-app官方历史版本下载方法
测试工具·postman
2501_924064111 天前
2025年跨端云真机测试平台深度测评:XR与折叠屏时代的兼容性之战
测试工具·移动端自动化测试·自动化测试脚本
Small black human2 天前
HTTP-Postman的安装及其使用
测试工具·postman
AIZHINAN2 天前
Appium 简介
自动化测试·测试工具·appium
吴free2 天前
mac电脑wireshark快速实现http接口抓包
网络·测试工具·http·wireshark
DeamoTech2 天前
ESCADA
物联网·测试工具
旷世奇才李先生3 天前
Selenium 安装使用教程
selenium·测试工具
巴里巴气3 天前
对selenium进行浏览器和驱动进行配置Windows | Linux
selenium·测试工具
旷世奇才李先生4 天前
Lua 安装使用教程
开发语言·lua
Accpdaiyekun4 天前
C# 操作mongodb 多次查询快还是使用管道查询速度快
mongodb·c#·lua