Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 246244d

Browse files
authored
Fix typo (#636)
fix nil check in docs example
1 parent b57508f commit 246244d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/apis.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ async def validate(ctx, nxt: HttpMiddleware):
661661
// Using the Go SDK we recommend using higher-order functions to define middleware
662662
func validate(next apis.Handler) apis.Handler {
663663
return func (ctx *apis.Ctx) error {
664-
if ctx.Request.Headers()["content-type"] != nil {
664+
if ctx.Request.Headers()["content-type"] == nil {
665665
ctx.Response.Status = 400
666666
ctx.Response.Body = []byte("header Content-Type is required")
667667

@@ -721,7 +721,7 @@ import (
721721

722722
func validate(next apis.Handler) apis.Handler {
723723
return func(ctx *apis.Ctx) error {
724-
if ctx.Request.Headers()["content-type"] != nil {
724+
if ctx.Request.Headers()["content-type"] == nil {
725725
ctx.Response.Status = 400
726726
ctx.Response.Body = []byte("header Content-Type is required")
727727

@@ -795,7 +795,7 @@ import (
795795

796796
func validate(next apis.Handler) apis.Handler {
797797
return func(ctx *apis.Ctx) error {
798-
if ctx.Request.Headers()["content-type"] != nil {
798+
if ctx.Request.Headers()["content-type"] == nil {
799799
ctx.Response.Status = 400
800800
ctx.Response.Body = []byte("header Content-Type is required")
801801

0 commit comments

Comments
 (0)