msgpack.go
This file
The walk stopped after 200 commits: lines older than cf32d2d point at it.
chore(deps): bump github.com/pelletier/go-toml/v2 from 2.2.2 to 2.2.4 (#4212)dependabot[bot]before adoptioncf32d2d
lines 1–43why, one step back1// Copyright 2017 Manu Martinez-Almeida. All rights reserved.2// Use of this source code is governed by a MIT style3// license that can be found in the LICENSE file.45//go:build !nomsgpack67package render89import (10 "net/http"1112 "github.com/ugorji/go/codec"13)1415// Check interface implemented here to support go build tag nomsgpack.16// See: https://github.com/gin-gonic/gin/pull/1852/17var (18 _ Render = MsgPack{}19)2021// MsgPack contains the given interface object.22type MsgPack struct {23 Data any24}2526var msgpackContentType = []string{"application/msgpack; charset=utf-8"}2728// WriteContentType (MsgPack) writes MsgPack ContentType.29func (r MsgPack) WriteContentType(w http.ResponseWriter) {30 writeContentType(w, msgpackContentType)31}3233// Render (MsgPack) encodes the given interface object and writes data with custom ContentType.34func (r MsgPack) Render(w http.ResponseWriter) error {35 return WriteMsgPack(w, r.Data)36}3738// WriteMsgPack writes MsgPack ContentType and encodes the given interface object.39func WriteMsgPack(w http.ResponseWriter, obj any) error {40 writeContentType(w, msgpackContentType)41 var mh codec.MsgpackHandle42 return codec.NewEncoder(w, &mh).Encode(obj)43}