ogen-go / ogen

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

Access http request headers in server function #1316

Open sigmonsays opened 3 weeks ago

sigmonsays commented 3 weeks 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 weeks 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