Skip to content

Commit 0ab9f12

Browse files
authored
Fixed https mocked server /put-data* endpoint. (#406)
1 parent a9930f6 commit 0ab9f12

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

mocked_servers/https/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
FROM golang:1.17 as build
1+
FROM golang:1.17 AS build
22
WORKDIR $GOPATH/main
33
COPY . .
4+
RUN go env -w GOPROXY=direct
5+
RUN GO111MODULE=on go mod download
46
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -o=/bin/main .
57

68
FROM scratch

mocked_servers/https/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
module github.com/aws-observability/aws-otel-test-framework/mockedservers/https
22

33
go 1.17
4+
5+
require github.com/gorilla/mux v1.8.0

mocked_servers/https/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
2+
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=

mocked_servers/https/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
"sync"
2323
"sync/atomic"
2424
"time"
25+
26+
"github.com/gorilla/mux"
2527
)
2628

2729
const (
@@ -89,8 +91,8 @@ func main() {
8991
go func(ts *transactionStore) {
9092
defer wg.Done()
9193

92-
dataApp := http.NewServeMux()
93-
dataApp.HandleFunc("/put-data/", ts.dataReceived)
94+
dataApp := mux.NewRouter()
95+
dataApp.PathPrefix("/put-data").HandlerFunc(ts.dataReceived)
9496
dataApp.HandleFunc("/trace/v1", ts.dataReceived)
9597
dataApp.HandleFunc("/metric/v1", ts.dataReceived)
9698
if err := http.ListenAndServeTLS(":443", CertFilePath, KeyFilePath, dataApp); err != nil {

0 commit comments

Comments
 (0)