Getting the Raw Query? #3511
Unanswered
mexicantexan
asked this question in
Q&A
Replies: 1 comment
-
Hello, the PopulateRequestContext middleware inserts HTTP request fields into the request context including the raw request URI which contains the query string. Here is an example: // ...
calcEndpoints = calc.NewEndpoints(calcSvc)
mux = goahttp.NewMuxer()
calcServer = calcsvr.New(calcEndpoints, mux, goahttp.RequestDecoder, goahttp.ResponseEncoder, nil, nil, nil)
calcSever.Use(middleware.PopulateRequestContext())
// ... The URI can then be retrieved in the method using: uri := ctx.Value(middleware.RequestURIKey) Alternatively you could write your own HTTP middleware that populates the parsed query string. Hope this helps! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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:
which I gathered from the following two pieces of documentation:
Is this the right way to do this?
Beta Was this translation helpful? Give feedback.
All reactions