Why can’t I store cookie after setting content-type to image/jpeg?

  node.js, question
import Koa from "koa";
 import Router from "koa-router";
 import request from "supertest";
 
 const app = new Koa();
 const router = new Router();
 const client = request.agent(app.listen(3000));
 
 router
 .get("/", async (ctx, next) => {
 
 try {
 let cv = ctx.cookies.get('temp');
 if (cv) {
 The console.log(cv)// the second request did not get the value of the cookie, and the cookie was not stored, possibly because the content-type is set incorrectly.
 ctx.type = 'image/jpeg';
 ctx.body = '233';  //Originally it was a buffer type data, which is brief here.
 ctx.status = 200;
 } else {
 await ctx.cookies.set('temp', '123456', {maxAge: 99999});
 ctx.type = 'image/jpeg';
 ctx.body = '233';
 ctx.status = 200;
 bracket
 
 
 } catch (e) {
 console.log(e)
 ctx.status = 400;
 bracket
 
 })
 
 app
 .use(router.routes())
 .use(router.allowedMethods());
 
 
 describe("test", () => {
 it("1", done => {
 client
 .get('/')
 .expect(200, (err, res) => {
 if (err) {
 done(err)
 } else {
 //The first request is that header inside has a set-cookie
 cookie = res.header["set-cookie"][0];
 console.log(cookie);
 done()
 bracket
 })
 });
 it("2", done => {
 client
 .get('/')
 .expect(200, done)
 });
 })

However, after I changed the content-type to another type, it can be stored correctly.
Is there a problem with setting the content-type to image/jpeg?
I checked that there is the content-type image/jpeg.

Different browsers have different treatments for different content-type. It was found that these treatments were customized by the browser manufacturer after customization of the browser. So I guess it is possible that you gave image. His logic inside thinks there will be no cookie addition. Try a different browser?