jojo/models/unittest/testdata
forgejo-backport-action 68f39ad66b [v14.0/forgejo] fix NewMockWebServer(): Headers never reached the http client (#11058)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/11007

Found while working on https://codeberg.org/forgejo/forgejo/pulls/10798#issuecomment-10083846: The symptom was that the go-github client never returned a `resp.After`, so I tracked down the root cause, which was that, with the mocked http server ...

Mocked headers never reached the calling client, because w.WriteHeader()
was called before the headers were set in the response.

Fix by moving w.WriteHeader() to the right place just before w.Write(),
which writes the body.

Test added which fails without the fix and succeeds with it.

Co-authored-by: Nils Goroll <nils.goroll@uplex.de>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11058
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2026-01-26 20:41:29 +01:00
..
GET_%2F [v14.0/forgejo] fix NewMockWebServer(): Headers never reached the http client (#11058) 2026-01-26 20:41:29 +01:00