Skip to content

Commit

Permalink
Make sure the query row & column get propagated everywhere
Browse files Browse the repository at this point in the history
Signed-off-by: Flynn <[email protected]>
  • Loading branch information
kflynn committed Oct 6, 2024
1 parent 7c923a0 commit 8442861
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/faces/faceserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ func (srv *FaceServer) SetupFromEnvironment() {
fmt.Printf("%s %s: colorService %v\n", time.Now().Format(time.RFC3339), srv.Name, srv.colorService)
}

func (srv *FaceServer) makeRequest(user string, userAgent string, service string, keyword string, subrequest string) *FaceResponse {
func (srv *FaceServer) makeRequest(user string, userAgent string, service string, keyword string, subrequest string, row int, col int) *FaceResponse {
start := time.Now()

url := fmt.Sprintf("http://%s/%s/", service, subrequest)
url := fmt.Sprintf("http://%s/%s/?row=%d&col=%d", service, subrequest, row, col)

if srv.debugEnabled {
fmt.Printf("%s %s: %s starting\n", time.Now().Format(time.RFC3339), srv.Name, url)
Expand Down Expand Up @@ -265,7 +265,7 @@ func (srv *FaceServer) faceGetHandler(r *http.Request, rstat *BaseRequestStatus)
colorCh := make(chan *FaceResponse)

go func() {
smileyCh <- srv.makeRequest(user, userAgent, srv.smileyService, "smiley", subrequest)
smileyCh <- srv.makeRequest(user, userAgent, srv.smileyService, "smiley", subrequest, row, column)
}()

go func() {
Expand Down
7 changes: 7 additions & 0 deletions pkg/faces/guiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ func (srv *GUIServer) guiGetHandler(w http.ResponseWriter, r *http.Request) {
reqStart := time.Now()

url := fmt.Sprintf("http://face/%s", r.URL.Path[6:])

rq := r.URL.RawQuery

if rq != "" {
url = fmt.Sprintf("%s?%s", url, rq)
}

user := r.Header.Get(srv.userHeaderName)
if user == "" {
user = "unknown"
Expand Down
6 changes: 6 additions & 0 deletions pkg/faces/ingressserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ func (srv *IngressServer) ingressGetHandler(r *http.Request, rstat *BaseRequestS
} else {
url := fmt.Sprintf("http://%s%s", srv.faceService, r.URL.Path)

rq := r.URL.RawQuery

if rq != "" {
url = fmt.Sprintf("%s?%s", url, rq)
}

if srv.debugEnabled {
fmt.Printf("%s %s: %s starting\n", time.Now().Format(time.RFC3339), srv.Name, url)
}
Expand Down

0 comments on commit 8442861

Please sign in to comment.