Skip to content

Commit

Permalink
check if req != nil
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasJenicek committed Oct 2, 2024
1 parent 89a072e commit 96a14c5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion _examples/golang-basics/example.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion _examples/golang-imports/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions helpers.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ func RequestFromContext(ctx context.Context) *http.Request {

func MethodCtx(ctx context.Context) (method, bool) {
req := RequestFromContext(ctx)
if req == nil {
return method{}, false
}

m, ok := methods[req.URL.Path]
if !ok {
Expand Down

0 comments on commit 96a14c5

Please sign in to comment.