mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-09 13:02:33 +02:00
refactor: fix code formatting and return flow
This commit is contained in:
parent
9b2ee628aa
commit
f6dc432419
3 changed files with 5 additions and 5 deletions
|
@ -36,9 +36,8 @@ func (res *fetchResult) ContentType() string {
|
||||||
if res.contentType == "" {
|
if res.contentType == "" {
|
||||||
if bytes.HasPrefix(res.icon, []byte("<svg")) || bytes.HasPrefix(res.icon, []byte("<?xml")) {
|
if bytes.HasPrefix(res.icon, []byte("<svg")) || bytes.HasPrefix(res.icon, []byte("<?xml")) {
|
||||||
return "image/svg+xml"
|
return "image/svg+xml"
|
||||||
} else {
|
|
||||||
return "image/x-icon"
|
|
||||||
}
|
}
|
||||||
|
return "image/x-icon"
|
||||||
}
|
}
|
||||||
return res.contentType
|
return res.contentType
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,9 @@ func List(cfg config.ConfigInstance, w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
switch what {
|
switch what {
|
||||||
case ListRoute:
|
case ListRoute:
|
||||||
if route := listRoute(which); route == nil {
|
route := listRoute(which)
|
||||||
|
if route == nil {
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
return
|
|
||||||
} else {
|
} else {
|
||||||
U.RespondJSON(w, r, route)
|
U.RespondJSON(w, r, route)
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,7 +234,8 @@ func TestOnCorrectness(t *testing.T) {
|
||||||
|
|
||||||
tests = append(tests, genCorrectnessTestCases("header", func(k, v string) *http.Request {
|
tests = append(tests, genCorrectnessTestCases("header", func(k, v string) *http.Request {
|
||||||
return &http.Request{
|
return &http.Request{
|
||||||
Header: http.Header{k: []string{v}}}
|
Header: http.Header{k: []string{v}},
|
||||||
|
}
|
||||||
})...)
|
})...)
|
||||||
tests = append(tests, genCorrectnessTestCases("query", func(k, v string) *http.Request {
|
tests = append(tests, genCorrectnessTestCases("query", func(k, v string) *http.Request {
|
||||||
return &http.Request{
|
return &http.Request{
|
||||||
|
|
Loading…
Add table
Reference in a new issue