Skip to content
Myr

toml.go

This file

Path

render/toml.go

36 lines · 820 bytes · Go

Last changed by

chore(render): do not export tomlContentType anymore (#4319)Varus Hsubefore adoption17d0b55

History of this file

Take it

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–17why, one step back
1// Copyright 2022 Gin Core Team. All rights reserved.
2// Use of this source code is governed by a MIT style3// license that can be found in the LICENSE file.45package render67import (8 "net/http"910 "github.com/pelletier/go-toml/v2"11)1213// TOML contains the given interface object.14type TOML struct {15 Data any16}17

chore(render): do not export tomlContentType anymore (#4319)Varus Hsubefore adoption17d0b55

line 18why, one step back
18var tomlContentType = []string{"application/toml; charset=utf-8"}

chore(deps): bump github.com/pelletier/go-toml/v2 from 2.2.2 to 2.2.4 (#4212)dependabot[bot]before adoptioncf32d2d

lines 19–34why, one step back
19
20// Render (TOML) marshals the given interface object and writes data with custom ContentType.21func (r TOML) Render(w http.ResponseWriter) error {22 r.WriteContentType(w)2324 bytes, err := toml.Marshal(r.Data)25 if err != nil {26 return err27 }2829 _, err = w.Write(bytes)30 return err31}3233// WriteContentType (TOML) writes TOML ContentType for response.34func (r TOML) WriteContentType(w http.ResponseWriter) {

chore(render): do not export tomlContentType anymore (#4319)Varus Hsubefore adoption17d0b55

line 35why, one step back
35 writeContentType(w, tomlContentType)

chore(deps): bump github.com/pelletier/go-toml/v2 from 2.2.2 to 2.2.4 (#4212)dependabot[bot]before adoptioncf32d2d

line 36why, one step back
36}