@@ -103,26 +103,26 @@ func (ctx *Ctx) Accepts(offers ...string) (offer string) {
103
103
}
104
104
105
105
specs := strings .Split (h , "," )
106
- for _ , value := range offers {
107
- mimetype := getMIME (value )
106
+ for i := range offers {
107
+ mimetype := getMIME (offers [ i ] )
108
108
// if mimetype != "" {
109
109
// mimetype = strings.Split(mimetype, ";")[0]
110
110
// } else {
111
111
// mimetype = offer
112
112
// }
113
- for _ , spec := range specs {
114
- spec = strings .TrimSpace (spec )
113
+ for k := range specs {
114
+ spec : = strings .TrimSpace (specs [ k ] )
115
115
if strings .HasPrefix (spec , "*/*" ) {
116
- return value
116
+ return offers [ i ]
117
117
}
118
118
119
119
if strings .HasPrefix (spec , mimetype ) {
120
- return value
120
+ return offers [ i ]
121
121
}
122
122
123
123
if strings .Contains (spec , "/*" ) {
124
124
if strings .HasPrefix (spec , strings .Split (mimetype , "/" )[0 ]) {
125
- return value
125
+ return offers [ i ]
126
126
}
127
127
}
128
128
}
@@ -142,15 +142,14 @@ func (ctx *Ctx) AcceptsCharsets(offers ...string) (offer string) {
142
142
}
143
143
144
144
specs := strings .Split (h , "," )
145
- for _ , value := range offers {
146
- for _ , spec := range specs {
147
-
148
- spec = strings .TrimSpace (spec )
145
+ for i := range offers {
146
+ for k := range specs {
147
+ spec := strings .TrimSpace (specs [k ])
149
148
if strings .HasPrefix (spec , "*" ) {
150
- return value
149
+ return offers [ i ]
151
150
}
152
- if strings .HasPrefix (spec , value ) {
153
- return value
151
+ if strings .HasPrefix (spec , offers [ i ] ) {
152
+ return offers [ i ]
154
153
}
155
154
}
156
155
}
@@ -169,14 +168,14 @@ func (ctx *Ctx) AcceptsEncodings(offers ...string) (offer string) {
169
168
}
170
169
171
170
specs := strings .Split (h , "," )
172
- for _ , value := range offers {
173
- for _ , spec := range specs {
174
- spec = strings .TrimSpace (spec )
171
+ for i := range offers {
172
+ for k := range specs {
173
+ spec : = strings .TrimSpace (specs [ k ] )
175
174
if strings .HasPrefix (spec , "*" ) {
176
- return value
175
+ return offers [ i ]
177
176
}
178
- if strings .HasPrefix (spec , value ) {
179
- return value
177
+ if strings .HasPrefix (spec , offers [ i ] ) {
178
+ return offers [ i ]
180
179
}
181
180
}
182
181
}
@@ -194,14 +193,14 @@ func (ctx *Ctx) AcceptsLanguages(offers ...string) (offer string) {
194
193
}
195
194
196
195
specs := strings .Split (h , "," )
197
- for _ , value := range offers {
198
- for _ , spec := range specs {
199
- spec = strings .TrimSpace (spec )
196
+ for i := range offers {
197
+ for k := range specs {
198
+ spec : = strings .TrimSpace (specs [ k ] )
200
199
if strings .HasPrefix (spec , "*" ) {
201
- return value
200
+ return offers [ i ]
202
201
}
203
- if strings .HasPrefix (spec , value ) {
204
- return value
202
+ if strings .HasPrefix (spec , offers [ i ] ) {
203
+ return offers [ i ]
205
204
}
206
205
}
207
206
}
@@ -441,7 +440,8 @@ func (ctx *Ctx) Fresh() bool {
441
440
}
442
441
var etagStal = true
443
442
var matches = parseTokenList (getBytes (noneMatch ))
444
- for _ , match := range matches {
443
+ for i := range matches {
444
+ match := matches [i ]
445
445
if match == etag || match == "W/" + etag || "W/" + match == etag {
446
446
etagStal = false
447
447
break
@@ -506,8 +506,8 @@ func (ctx *Ctx) Is(extension string) (match bool) {
506
506
507
507
exts , _ := mime .ExtensionsByType (ctx .Get (HeaderContentType ))
508
508
if len (exts ) > 0 {
509
- for _ , item := range exts {
510
- if item == extension {
509
+ for i := range exts {
510
+ if exts [ i ] == extension {
511
511
return true
512
512
}
513
513
}
@@ -555,7 +555,8 @@ func (ctx *Ctx) JSONP(data interface{}, callback ...string) error {
555
555
// Links joins the links followed by the property to populate the response’s Link HTTP header field.
556
556
func (ctx * Ctx ) Links (link ... string ) {
557
557
h := ""
558
- for i , l := range link {
558
+ for i := range link {
559
+ l := link [i ]
559
560
if i % 2 == 0 {
560
561
h += "<" + l + ">"
561
562
} else {
0 commit comments