Repository: next.js
Issue: [NEXT-1065] Breaking change in 12.3.4 for res.end(res.getHeader('Set-Cookie'))
Labels: bug,Runtime,linear: next

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
      Platform: linux
      Arch: x64
      Version: #202206141358~1655919116~22.04~1db9e34 SMP PREEMPT Wed Jun 22 19
    Binaries:
      Node: 18.16.0
      npm: 9.5.1
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 12.3.4
      eslint-config-next: 12.0.7
      react: 18.2.0
      react-dom: 18.2.0

warn  - Latest canary version not detected, detected: "12.3.4", newest: "13.3.2-canary.9".
        Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
        Read more - https://nextjs.org/docs/messages/opening-an-issue
```

P.S. The problem is with the version we were using, not version 13 or even a canary version, this is an issue with your versioning practices.  It is probably fixed somewhere along the line _or_ this is the proper intended functionality; however, as a result of your versioning practices, our application broke.



### Which area(s) of Next.js are affected? (leave empty if unsure)

Middleware / Edge (API routes, runtime)

### Link to the code that reproduces this issue

https://github.com/davidrhoderick/next-resend-test

### To Reproduce

Clone the `master` branch locally.  If you run `npm i && npm run dev` and open the application on `http://localhost:3000`, you'll see in the console that the `api/set-cookie` route returns a 200 status and if you look at the browser storage, it will have an `our-cookie` cookie.

Now check out the `upgrading-to-12.3.4` branch.  All that's changed is we've forced the version of Next.js from 12.3.1 to 12.3.4 (I actually believe this was introduced in 12.3.3 but this was our exact situation).  If you run `rm -rf node_modules && npm i && npm run dev` & open the application, you'll see in the console a 500 status for the `api/set-cookie` route.  If you've reset your cookie storage in the browser, you'll see there is no `our-cookie` set.

### Describe the Bug

The bug is that when upgrading from hotfix version 12.3.1 to 12.3.4, the `res.getHeader('Set-Cookie')` call returns an `array` instead of a `string` as it previously did.  The result is that when you implement by putting it inside `res.end()`, it will cause a 500 error.  This is a breaking change in a hotfix version update.  It broke our site's ability to set cookies when upgrading by 3 hotfix versions.  We had our project set on Next.js version 12.3 and have now been forced to specify 12.3.1.

### Expected Behavior

When introducing a change that breaks the application, it _should_ be a major update; however, if it's going to affect such a small part, it should at least be a minor version so that by locking into 12.3, we wouldn't have broken our application.

### Which browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_

<sub>[NEXT-1065](https://linear.app/vercel/issue/NEXT-1065/breaking-change-in-1234-for-resendresgetheaderset-cookie)</sub>