mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-11-03 22:22:25 -06:00 
			
		
		
		
	* start fixing up tests * fix up tests + automate with drone * fiddle with linting * messing about with drone.yml * some more fiddling * hmmm * add cache * add vendor directory * verbose * ci updates * update some little things * update sig
		
			
				
	
	
		
			40 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2014 Manu Martinez-Almeida.  All rights reserved.
 | 
						|
// Use of this source code is governed by a MIT style
 | 
						|
// license that can be found in the LICENSE file.
 | 
						|
 | 
						|
package render
 | 
						|
 | 
						|
import "net/http"
 | 
						|
 | 
						|
// Render interface is to be implemented by JSON, XML, HTML, YAML and so on.
 | 
						|
type Render interface {
 | 
						|
	// Render writes data with custom ContentType.
 | 
						|
	Render(http.ResponseWriter) error
 | 
						|
	// WriteContentType writes custom ContentType.
 | 
						|
	WriteContentType(w http.ResponseWriter)
 | 
						|
}
 | 
						|
 | 
						|
var (
 | 
						|
	_ Render     = JSON{}
 | 
						|
	_ Render     = IndentedJSON{}
 | 
						|
	_ Render     = SecureJSON{}
 | 
						|
	_ Render     = JsonpJSON{}
 | 
						|
	_ Render     = XML{}
 | 
						|
	_ Render     = String{}
 | 
						|
	_ Render     = Redirect{}
 | 
						|
	_ Render     = Data{}
 | 
						|
	_ Render     = HTML{}
 | 
						|
	_ HTMLRender = HTMLDebug{}
 | 
						|
	_ HTMLRender = HTMLProduction{}
 | 
						|
	_ Render     = YAML{}
 | 
						|
	_ Render     = Reader{}
 | 
						|
	_ Render     = AsciiJSON{}
 | 
						|
	_ Render     = ProtoBuf{}
 | 
						|
)
 | 
						|
 | 
						|
func writeContentType(w http.ResponseWriter, value []string) {
 | 
						|
	header := w.Header()
 | 
						|
	if val := header["Content-Type"]; len(val) == 0 {
 | 
						|
		header["Content-Type"] = value
 | 
						|
	}
 | 
						|
}
 |