Add ResponseWriter.Flush function
This commit is contained in:
		
							parent
							
								
									a912ef996a
								
							
						
					
					
						commit
						61b417a5c4
					
				@ -37,7 +37,8 @@ func main() {
 | 
			
		||||
 | 
			
		||||
func stream(w *gemini.ResponseWriter, r *gemini.Request) {
 | 
			
		||||
	for {
 | 
			
		||||
		fmt.Fprintln(w, time.Now())
 | 
			
		||||
		fmt.Fprintln(w, time.Now().UTC())
 | 
			
		||||
		w.Flush()
 | 
			
		||||
		time.Sleep(time.Second)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -283,7 +283,7 @@ func (w *ResponseWriter) SetMediaType(mediatype string) {
 | 
			
		||||
	w.mediatype = mediatype
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Write writes the response body.
 | 
			
		||||
// Write writes data to the connection as part of the response body.
 | 
			
		||||
// If the response status does not allow for a response body, Write returns
 | 
			
		||||
// ErrBodyNotAllowed.
 | 
			
		||||
//
 | 
			
		||||
@ -303,6 +303,11 @@ func (w *ResponseWriter) Write(b []byte) (int, error) {
 | 
			
		||||
	return w.b.Write(b)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Flush writes any buffered data to the underlying io.Writer.
 | 
			
		||||
func (w *ResponseWriter) Flush() error {
 | 
			
		||||
	return w.b.Flush()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// A Responder responds to a Gemini request.
 | 
			
		||||
type Responder interface {
 | 
			
		||||
	// Respond accepts a Request and constructs a Response.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user