Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
81cfb4ec
Commit
81cfb4ec
authored
Apr 22, 2011
by
Brad Fitzpatrick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: fix FileServer's default text content type
Fixes #1729 R=rsc, adg CC=golang-dev
https://golang.org/cl/4443057
parent
75ca6d18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
src/pkg/http/fs.go
src/pkg/http/fs.go
+1
-1
src/pkg/http/fs_test.go
src/pkg/http/fs_test.go
+1
-1
No files found.
src/pkg/http/fs.go
View file @
81cfb4ec
...
@@ -143,7 +143,7 @@ func serveFile(w ResponseWriter, r *Request, name string, redirect bool) {
...
@@ -143,7 +143,7 @@ func serveFile(w ResponseWriter, r *Request, name string, redirect bool) {
n
,
_
:=
io
.
ReadFull
(
f
,
buf
[
:
])
n
,
_
:=
io
.
ReadFull
(
f
,
buf
[
:
])
b
:=
buf
[
:
n
]
b
:=
buf
[
:
n
]
if
isText
(
b
)
{
if
isText
(
b
)
{
ctype
=
"text
-
plain; charset=utf-8"
ctype
=
"text
/
plain; charset=utf-8"
}
else
{
}
else
{
// generic binary
// generic binary
ctype
=
"application/octet-stream"
ctype
=
"application/octet-stream"
...
...
src/pkg/http/fs_test.go
View file @
81cfb4ec
...
@@ -104,7 +104,7 @@ func TestServeFileContentType(t *testing.T) {
...
@@ -104,7 +104,7 @@ func TestServeFileContentType(t *testing.T) {
t
.
Errorf
(
"Content-Type mismatch: got %q, want %q"
,
h
,
want
)
t
.
Errorf
(
"Content-Type mismatch: got %q, want %q"
,
h
,
want
)
}
}
}
}
get
(
"text
-
plain; charset=utf-8"
)
get
(
"text
/
plain; charset=utf-8"
)
override
=
true
override
=
true
get
(
ctype
)
get
(
ctype
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment