summaryrefslogtreecommitdiff
path: root/handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'handlers.go')
-rw-r--r--handlers.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/handlers.go b/handlers.go
index d918fd0..64ea5c0 100644
--- a/handlers.go
+++ b/handlers.go
@@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"mime"
+ "net/http"
"net/url"
"strings"
@@ -57,6 +58,14 @@ func docType(u *url.URL, response *sliderule.Response) string {
}
}
+ if u.Scheme == "http" || u.Scheme == "https" {
+ resp := response.Meta.(*http.Response)
+ mtype, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
+ if err == nil {
+ return mtype
+ }
+ }
+
return "text/plain"
}