Sfoglia il codice sorgente

test url with abc

master
Patrick Peng Sun 8 anni fa
parent
commit
7cc6c88f76
2 ha cambiato i file con 13 aggiunte e 1 eliminazioni
  1. +3
    -1
      crmpixel.go
  2. +10
    -0
      server.go

+ 3
- 1
crmpixel.go Vedi File

"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"log"
"math/rand" "math/rand"
"net/http" "net/http"
"net/url" "net/url"
} }


func crmpixel(w http.ResponseWriter, r *http.Request) { func crmpixel(w http.ResponseWriter, r *http.Request) {

//log.Println("a")
log.Println(getHTTPRequestQuery(r, "abc"))
cookie := crmpixelCookie(r) cookie := crmpixelCookie(r)
http.SetCookie(w, &cookie) http.SetCookie(w, &cookie)



+ 10
- 0
server.go Vedi File

w.WriteHeader(http.StatusNotFound) w.WriteHeader(http.StatusNotFound)
fmt.Fprintf(w, "not found") fmt.Fprintf(w, "not found")
} }

func getHTTPRequestQuery(r *http.Request, name string) (value string) {
rq := r.URL.RawQuery
m, _ := url.ParseQuery(rq)
v, ok := m[name]
if ok {
value = v[0]
}
return
}

Loading…
Annulla
Salva