Nodejs supertest test file upload function

1. In the background, http, uses eggjs, to test ordinary get,post. There is no problem
2. There is a problem with test file upload

    it("file upload", async () => {
        let data:any = await new Promise(resolve => {
            app.httpRequest().post("/api/company/add")
            .set("Content-Type", "multipart/form-data")
            .field("companyName", "supertest")
            .field("projectId", 1)
            .attach("logo", "/zzj1026/Rnx/RaEgg/static/public/user/avator/9bf15f495f976447cde6b422f579f910.jpg")
            .end((err,res) => {
                if(err) console.log(err);
                resolve({status: true, data:res});
            });            
        });
        console.log(data);
    });
Mar.03,2021

where is your back-end interface code?

do you need the egg-multipart plug-in to upload files using egg

?
Menu