Skip to content

Commit 87d3556

Browse files
docs(README): update example code
1 parent ac883f9 commit 87d3556

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ import (
7272
)
7373

7474
// JSON marshals v to JSON, automatically escaping HTML,
75-
// setting the Content-Type header as application/json,
75+
// setting the Content-Type header as "application/json; charset=utf-8",
7676
// sends an HTTP response header with the provided statusCode and
7777
// writes the marshaled v as bytes to the connection as part of an HTTP reply.
78-
func JSON(w http.ResponseWriter, v any, statusCode int) {
78+
func JSON(w http.ResponseWriter, statusCode int, v any) {
7979
var buf bytes.Buffer
8080
enc := json.NewEncoder(&buf)
8181
enc.SetEscapeHTML(true)

0 commit comments

Comments
 (0)