Skip to content

Commit

Permalink
add content disposition
Browse files Browse the repository at this point in the history
  • Loading branch information
myussufz committed Apr 3, 2019
2 parents 699ca69 + b5c208e commit c36fbbe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions content_type_mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (
ContentTypeHTML = "html"
ContentTypeCSS = "css"
ContentTypeJS = "js"
ContentTypeExcel = "xlsx"
ContentTypeAny = ""
)

Expand All @@ -31,6 +32,7 @@ var contentTypeMapper = map[string]func(sw *storage.Writer){
ContentTypeHTML: contentTypeHTML,
ContentTypeCSS: contentTypeCSS,
ContentTypeJS: contentTypeJS,
ContentTypeExcel: contentTypeExcel,
// ContentTypeAny: contentTypeAny,
}

Expand Down Expand Up @@ -84,3 +86,8 @@ func contentTypeCSS(sw *storage.Writer) {
func contentTypeJS(sw *storage.Writer) {
sw.ContentType = "application/javascript"
}

func contentTypeExcel(sw *storage.Writer) {
sw.ContentType = "application/vnd.ms-excel"
sw.ContentDisposition = fmt.Sprintf("attachment;filename=%s", sw.Name)
}

0 comments on commit c36fbbe

Please sign in to comment.