This commit is contained in:
hoteas 2017-10-12 03:19:44 +00:00
parent 730e8441ef
commit b0d2e17b06
2 changed files with 5 additions and 18 deletions

View File

@ -263,7 +263,7 @@ func (this *Application) handler(w http.ResponseWriter, req *http.Request) {
//设置header
mimeStr := Substr(path, strings.LastIndex(path, "."), len(path))
//fmt.Println(mimeStr)
//类型判断并设置Content-Type
if value, ok := mimeMaps[mimeStr]; ok {

21
mime.go
View File

@ -1,16 +1,3 @@
// Copyright 2014 beego Author. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package hotime
@ -78,7 +65,7 @@ var mimeMaps = map[string]string{
".crt": "application/pkix-cert",
".crx": "application/x-chrome-extension",
".csh": "text/x-scriptcsh",
".css": "text/css",
".css": "text/css;charset=utf-8",
".csv": "text/csv",
".cxx": "text/plain",
".dar": "application/x-dar",
@ -149,8 +136,8 @@ var mimeMaps = map[string]string{
".hqx": "application/binhex",
".hta": "application/hta",
".htc": "text/x-component",
".htm": "text/html",
".html": "text/html",
".htm": "text/html;charset=utf-8",
".html": "text/html;charset=utf-8",
".htmls": "text/html",
".htt": "text/webviewhtml",
".htx": "text/html",
@ -184,7 +171,7 @@ var mimeMaps = map[string]string{
".jpeg": "image/jpeg",
".jpg": "image/jpeg",
".jps": "image/x-jps",
".js": "application/javascript",
".js": "application/javascript;charset=utf-8",
".json": "application/json",
".jut": "image/jutvision",
".kar": "audio/midi",