fiber-server generate incorrect type for header value
Hi!👋🏻
Current template for fiber-server has incorrect type for header values, because HTTP Spec allow sending multiple http headers with the same name, like Set-Cookie header.
Need to change template for generate correct compiled code.
Generated code by template:
headers := c.GetReqHeaders() //map[string][]string type
...
if value, found := headers[http.CanonicalHeaderKey("x-app-version")]; found { // value has []string type
var XAppVersion ApplicationVersion
// value bust be string
err = runtime.BindStyledParameterWithOptions("simple", "x-app-version", value, &XAppVersion, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: true})
if err != nil {
return fiber.NewError(fiber.StatusBadRequest, fmt.Errorf("Invalid format for parameter x-app-version: %w", err).Error())
}
params.XAppVersion = XAppVersion
} else {
err = fmt.Errorf("Header parameter x-app-version is required, but not found: %w", err)
return fiber.NewError(fiber.StatusBadRequest, err.Error())
}
This problem appeared after fiber release 2.50.0 when API for GetRequestHeaders() was changed. Please merge my changes for hassle-free quick start using oapi with latest fiber version. Thanks!
Waiting for that too!
Looks like dead repository...
Waiting for that too!!!!
+1
Any news?
Hey @turbo-nyasha is this "completed" because it's been fixed through some other means?
@jamietanna I assume that it was closed because the author was just tired of waiting for news, and that there is another, similar problem that is already being solved. Please pay attention on it https://github.com/oapi-codegen/oapi-codegen/pull/1639