Skip to content
Myr

data.go

This file

Path

render/data.go

25 lines · 639 bytes · Go

Last changed by

chore: update go.mod and remove space from copyright (#3158)thinkeroubefore adoption4b68a5f

History of this file

Take it

1// Copyright 2014 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.45package render67import "net/http"89// Data contains ContentType and bytes data.10type Data struct {11	ContentType string12	Data        []byte13}1415// Render (Data) writes data with custom ContentType.16func (r Data) Render(w http.ResponseWriter) (err error) {17	r.WriteContentType(w)18	_, err = w.Write(r.Data)19	return20}2122// WriteContentType (Data) writes custom ContentType.23func (r Data) WriteContentType(w http.ResponseWriter) {24	writeContentType(w, []string{r.ContentType})25}