fdk-go icon indicating copy to clipboard operation
fdk-go copied to clipboard

get the request query params

Open deepakpcontus opened this issue 1 year ago • 1 comments

I am trying to get the request URL and parameters. But I am unable to get it. What is the method I can use to get the request params?

deepakpcontus avatar May 26 '23 12:05 deepakpcontus

Have you checked the HTTPContext interface? https://github.com/fnproject/fdk-go/blob/master/fdk.go#L131

The fdk package has the exported function GetContext that gets fdk.Context from context.Context passed in your function. Once you have the fdk.Context you can perform a type assertion to fdk.HTTPContext and access URL using the interface's methods. Note that your type assertion will succeed for HTTP calls, i.e., running fn server locally and calling function by API or using OCI API GW.

metamemelord avatar May 30 '23 04:05 metamemelord