ogen-go / ogen

OpenAPI v3 code generator for go
https://ogen.dev
Apache License 2.0
1.45k stars 86 forks source link

Access http request headers in server function #1316

Open sigmonsays opened 2 months ago

sigmonsays commented 2 months ago

Description

Given the folowing function signature func (me *MyApi) SomeMethod(ctx context.Context, req *api.SomeMethodRequest) (*api.SomeMethodResponse, error)

How do I access the original http.Request object, I need access to http headers.

References

utherbit commented 2 months ago

You can try to create middleware that will add the raw query to the context.

I think ogen strives for exact compliance with the specification and the server, so you can't process something that is not in the specification in secret from users