Replies: 1 comment 1 reply
-
Example: func main() {
e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.JSON(http.StatusOK, map[string]string{})
})
log.Fatal(e.Start(":8080"))
} Output: x@x:~/code$ curl -v http://localhost:8080
* Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
< Date: Thu, 23 Dec 2021 17:39:42 GMT
< Content-Length: 3
<
{}
* Connection #0 to host localhost left intact |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Guys, can we return an empty object on JSON response
{}
insteadnull
value, if possible how?Expected JSON response
Current JSON response
Beta Was this translation helpful? Give feedback.
All reactions