Skip to content

Commit

Permalink
Upd params (#4)
Browse files Browse the repository at this point in the history
* fix

* fix

* fix

* fix

* fix

---------

Co-authored-by: elops-od <[email protected]>
  • Loading branch information
elopsod and elops-od authored Jul 16, 2024
1 parent 0ac2bf6 commit 9283f64
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ func HttpPing(w http.ResponseWriter, r *http.Request) {
for key, values := range r.Header {
headers = append(headers, fmt.Sprintf("%s: %s", key, strings.Join(values, " ")))
}

params := []string{}
for key, values := range r.URL.Query() {
params = append(params, fmt.Sprintf("%s: %s", key, strings.Join(values, " ")))
}
// Send headers, path, and body in the response
fmt.Fprintln(w, "Host:", host)
fmt.Fprintln(w, "Path:", path)
Expand All @@ -139,6 +144,7 @@ func HttpPing(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Scheme:", scheme)
fmt.Fprintln(w, "Hostname:", hostname)
fmt.Fprintln(w, "Headers:\n\t", strings.Join(headers[:], "\n\t "))
fmt.Fprintln(w, "Params:\n\t", strings.Join(params[:], "\n\t "))
fmt.Fprintln(w, "Body:\n\t", string(body))
}

Expand Down

0 comments on commit 9283f64

Please sign in to comment.