File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -301,6 +301,24 @@ func Handle(w http.ResponseWriter, r *http.Request) {
301301}
302302```
303303
304+ Example retrieving request query strings
305+
306+ ``` go
307+ package function
308+ import (
309+ " fmt"
310+ " net/http"
311+ )
312+ func Handle (w http .ResponseWriter , r *http .Request ) {
313+ // Parses RawQuery and returns the corresponding
314+ // values as a map[string][]string
315+ // for more info https://golang.org/pkg/net/url/#URL.Query
316+ query := r.URL .Query ()
317+ w.WriteHeader (http.StatusOK )
318+ w.Write ([]byte (fmt.Sprintf (" id: %s " , query.Get (" id" ))))
319+ }
320+ ```
321+
304322#### Advanced usage - Go sub-modules via ` GO_REPLACE.txt `
305323
306324For this example you will need to be using Go 1.13 or newer and Go modules, enable this via ` faas-cli build --build-arg GO111MODULE=on ` .
You can’t perform that action at this time.
0 commit comments