goadesign / goa

🌟 Goa: Elevate Go API development! 🚀 Streamlined design, automatic code generation, and seamless HTTP/gRPC support. ✨
https://goa.design
MIT License
5.54k stars 556 forks source link

Getting the Raw Query? #3510

Closed mexicantexan closed 3 months ago

mexicantexan commented 3 months ago

How do I get access to the raw query? Is it in the context? If so, what would the key be? Or is there a way to do this in the design file? The index/order of the parameters I'm trying to get from the raw query is important, and can happen in any order so I don't think parsing them in the design file is the correct approach since I believe they'll lose their original order.

Right now I have this:

httpRequest, _ := ctx.Value({{NOT_SURE_WHAT_TO_PUT_HERE}}).(*http.Request)
rawQuery := httpRequest.URL.RawQuery

which I gathered from the following two pieces of documentation:

Is this the right way to do this?

mexicantexan commented 3 months ago

Whoops, I thought I was adding this to the discussion panel. My fault here is the linked discussion: https://github.com/goadesign/goa/discussions/3511