aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-02-21 18:52:04 -0500
committerAdnan Maolood <[email protected]>2021-02-21 18:52:06 -0500
commit2c64db3863cc6ba3c930d43a3a6b8ee60f3263fb (patch)
treedff42af8b6f62ef609c06762e75c2d4ff10b9bfe
parentclient: Remove Timeout (diff)
downloadgo-gemini-2c64db3863cc6ba3c930d43a3a6b8ee60f3263fb.tar.xz
go-gemini-2c64db3863cc6ba3c930d43a3a6b8ee60f3263fb.zip
Rename ResponseWriter.MediaType to SetMediaType
-rw-r--r--fs.go2
-rw-r--r--response.go10
-rw-r--r--timeout.go2
3 files changed, 7 insertions, 7 deletions
diff --git a/fs.go b/fs.go
index bb4f050..b47b3a2 100644
--- a/fs.go
+++ b/fs.go
@@ -51,7 +51,7 @@ func serveContent(w ResponseWriter, name string, content io.Reader) {
// Detect mimetype from file extension
ext := path.Ext(name)
mimetype := mime.TypeByExtension(ext)
- w.MediaType(mimetype)
+ w.SetMediaType(mimetype)
io.Copy(w, content)
}
diff --git a/response.go b/response.go
index 1090ed5..1abe47c 100644
--- a/response.go
+++ b/response.go
@@ -160,18 +160,18 @@ func (r *Response) Write(w io.Writer) error {
// A ResponseWriter may not be used after the Handler.ServeGemini method
// has returned.
type ResponseWriter interface {
- // MediaType sets the media type that will be sent by Write for a
+ // SetMediaType sets the media type that will be sent by Write for a
// successful response. If no media type is set, a default of
// "text/gemini; charset=utf-8" will be used.
//
// Setting the media type after a call to Write or WriteHeader has
// no effect.
- MediaType(string)
+ SetMediaType(string)
// Write writes the data to the connection as part of a Gemini response.
//
// If WriteHeader has not yet been called, Write calls WriteHeader with
- // StatusSuccess and the media type set in MediaType before writing the data.
+ // StatusSuccess and the media type set in SetMediaType before writing the data.
// If no media type was set, Write uses a default media type of
// "text/gemini; charset=utf-8".
Write([]byte) (int, error)
@@ -181,7 +181,7 @@ type ResponseWriter interface {
//
// If WriteHeader is not called explicitly, the first call to Write
// will trigger an implicit call to WriteHeader with a successful
- // status code and the media type set in MediaType.
+ // status code and the media type set in SetMediaType.
//
// The provided code must be a valid Gemini status code.
// The provided meta must not be longer than 1024 bytes.
@@ -210,7 +210,7 @@ func newResponseWriter(w io.Writer) *responseWriter {
}
}
-func (w *responseWriter) MediaType(mediatype string) {
+func (w *responseWriter) SetMediaType(mediatype string) {
w.mediatype = mediatype
}
diff --git a/timeout.go b/timeout.go
index e5d4b28..a2fcd41 100644
--- a/timeout.go
+++ b/timeout.go
@@ -71,7 +71,7 @@ type timeoutWriter struct {
timedOut bool
}
-func (w *timeoutWriter) MediaType(mediatype string) {
+func (w *timeoutWriter) SetMediaType(mediatype string) {
w.mu.Lock()
defer w.mu.Unlock()
w.mediatype = mediatype