Description

I am creating a response based on a http call to an external server. My server response needs to have the same headers as the external server call.

How to reproduce

This is how I fixed my problem:

    for k, vv := range resp.Header {
        for _, v := range vv {
            c.Header(k, v)
        }
    }

    c.DataFromReader(200, resp.ContentLength, "application/json", resp.Body, nil)

I was expecting to be able to do something like the following:

    c.DataFromReader(200, resp.ContentLength, "application/json", resp.Body, resp.Header)

<!-- The smallest possible code example to show the problem that can be compiled, li

Environment

  • go version: 1.20
  • gin version (or commit ref): 1.9.0
  • operating system: mac