Skip to content

Commit

Permalink
chore: improve
Browse files Browse the repository at this point in the history
  • Loading branch information
StarpTech committed Jan 21, 2024
1 parent b0f67d5 commit 5c48f5b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions aws-lambda-router/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ func main() {

// If HTTP_PORT is set, we assume we are running the router without lambda
if httpPort != "" {
if err := svr.Server().ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
if err := svr.HttpServer().ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
logger.Fatal("Could not start server", zap.Error(err))
}
return
}

lambdaHandler := algnhsa.New(svr.Server().Handler, nil)
lambdaHandler := algnhsa.New(svr.HttpServer().Handler, nil)
lambda.StartWithOptions(lambdaHandler,
lambda.WithContext(ctx),
// Registered an internal extensions which gives us 500ms to shutdown
Expand Down
2 changes: 1 addition & 1 deletion aws-lambda-router/internal/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestHandler(t *testing.T) {
svr, err := r.NewServer(context.Background())
require.NoError(t, err)

handler := algnhsa.New(svr.Server().Handler, &algnhsa.Options{
handler := algnhsa.New(svr.HttpServer().Handler, &algnhsa.Options{
RequestType: algnhsa.RequestTypeAPIGatewayV2,
})
j, err := json.Marshal(events.APIGatewayV2HTTPRequest{
Expand Down
2 changes: 1 addition & 1 deletion router-tests/testenv/testenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func createTestEnv(t testing.TB, cfg *Config) (*Environment, error) {
require.NoError(t, err)

go func() {
if err := svr.Server().ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
if err := svr.HttpServer().ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
t.Errorf("could not start router: %s", err)
}
}()
Expand Down
4 changes: 2 additions & 2 deletions router/core/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type (
}

Server interface {
Server() *http.Server
HttpServer() *http.Server
HealthChecks() health.Checker
}

Expand Down Expand Up @@ -1072,7 +1072,7 @@ func (r *server) HealthChecks() health.Checker {
return r.healthChecks
}

func (r *server) Server() *http.Server {
func (r *server) HttpServer() *http.Server {
return r.server
}

Expand Down

0 comments on commit 5c48f5b

Please sign in to comment.