@@ -8,30 +8,30 @@ type MimeHeader struct {
88}
99
1010type AcceptHeader struct {
11- mheaders []MimeHeader
11+ MHeaders []MimeHeader
1212}
1313
1414func NewAcceptHeaderPlain (mheaders []MimeHeader ) AcceptHeader {
15- return AcceptHeader {mheaders : mheaders }
15+ return AcceptHeader {MHeaders : mheaders }
1616}
1717
1818func NewAcceptHeader (mheaders []MimeHeader ) AcceptHeader {
19- ah := AcceptHeader {mheaders : mheaders }
19+ ah := AcceptHeader {MHeaders : mheaders }
2020 ah .sort ()
2121
2222 return ah
2323}
2424
2525// Len function for sort.Interface interface.
2626func (ah AcceptHeader ) Len () int {
27- return len (ah .mheaders )
27+ return len (ah .MHeaders )
2828}
2929
3030// Less function for sort.Interface interface.
3131func (ah AcceptHeader ) Less (i , j int ) bool {
3232 // Sort accepts by quality value. If quality is not equal, then return is i less than j
33- if ah .mheaders [i ].Quality != ah .mheaders [j ].Quality {
34- return ah .mheaders [i ].Quality < ah .mheaders [j ].Quality
33+ if ah .MHeaders [i ].Quality != ah .MHeaders [j ].Quality {
34+ return ah .MHeaders [i ].Quality < ah .MHeaders [j ].Quality
3535 }
3636
3737 less , done := ah .lessWildcard (i , j )
@@ -43,15 +43,15 @@ func (ah AcceptHeader) Less(i, j int) bool {
4343}
4444
4545func (ah AcceptHeader ) lessParams (i , j int ) bool {
46- li := len (ah .mheaders [i ].Params )
47- _ , ok := ah .mheaders [i ].Params ["q" ]
46+ li := len (ah .MHeaders [i ].Params )
47+ _ , ok := ah .MHeaders [i ].Params ["q" ]
4848
4949 if ok {
5050 li --
5151 }
5252
53- lj := len (ah .mheaders [j ].Params )
54- _ , ok = ah .mheaders [j ].Params ["q" ]
53+ lj := len (ah .MHeaders [j ].Params )
54+ _ , ok = ah .MHeaders [j ].Params ["q" ]
5555
5656 if ok {
5757 lj --
@@ -63,23 +63,23 @@ func (ah AcceptHeader) lessParams(i, j int) bool {
6363func (ah AcceptHeader ) lessWildcard (i , j int ) (less , done bool ) {
6464 // '*' value has less priority than a specific type
6565 // If i contains '*' and j has specific type, then i less than j
66- if ah .mheaders [i ].Type == MimeAny && ah .mheaders [j ].Type != MimeAny {
66+ if ah .MHeaders [i ].Type == MimeAny && ah .MHeaders [j ].Type != MimeAny {
6767 return true , true
6868 }
6969
7070 // If i contains a specific type and j contains '*' then i greater than j
71- if ah .mheaders [i ].Type != MimeAny && ah .mheaders [j ].Type == MimeAny {
71+ if ah .MHeaders [i ].Type != MimeAny && ah .MHeaders [j ].Type == MimeAny {
7272 return false , true
7373 }
7474
7575 // '*' value has less priority than a specific type
7676 // If i contains '*' and j has specific type, then i less than j
77- if ah .mheaders [i ].Subtype == MimeAny && ah .mheaders [j ].Subtype != MimeAny {
77+ if ah .MHeaders [i ].Subtype == MimeAny && ah .MHeaders [j ].Subtype != MimeAny {
7878 return true , true
7979 }
8080
8181 // If i contains a specific type and j contains '*' then i greater than j
82- if ah .mheaders [i ].Subtype != MimeAny && ah .mheaders [j ].Subtype == MimeAny {
82+ if ah .MHeaders [i ].Subtype != MimeAny && ah .MHeaders [j ].Subtype == MimeAny {
8383 return false , true
8484 }
8585
@@ -88,7 +88,7 @@ func (ah AcceptHeader) lessWildcard(i, j int) (less, done bool) {
8888
8989// Swap function for sort.Interface interface.
9090func (ah * AcceptHeader ) Swap (i , j int ) {
91- ah .mheaders [i ], ah .mheaders [j ] = ah .mheaders [j ], ah .mheaders [i ]
91+ ah .MHeaders [i ], ah .MHeaders [j ] = ah .MHeaders [j ], ah .MHeaders [i ]
9292}
9393
9494// Add mime header to accept header.
@@ -100,7 +100,7 @@ func (ah *AcceptHeader) Add(mh MimeHeader) {
100100 return
101101 }
102102
103- ah .mheaders = append (ah .mheaders , mh )
103+ ah .MHeaders = append (ah .MHeaders , mh )
104104
105105 ah .sort ()
106106}
@@ -116,7 +116,7 @@ func (ah *AcceptHeader) Set(mhs []MimeHeader) {
116116 }
117117 }
118118
119- ah .mheaders = mheaders
119+ ah .MHeaders = mheaders
120120
121121 ah .sort ()
122122}
@@ -126,7 +126,7 @@ func (ah *AcceptHeader) Set(mhs []MimeHeader) {
126126// Second parameter returns matched common type.
127127// Third parameter returns matched common type or default type applied.
128128func (ah AcceptHeader ) Negotiate (ctypes []string , dtype string ) (accept MimeHeader , mimeType string , matched bool ) {
129- if len (ctypes ) == 0 || len (ah .mheaders ) == 0 {
129+ if len (ctypes ) == 0 || len (ah .MHeaders ) == 0 {
130130 return MimeHeader {}, dtype , false
131131 }
132132
@@ -135,7 +135,7 @@ func (ah AcceptHeader) Negotiate(ctypes []string, dtype string) (accept MimeHead
135135 mhid := - 1
136136
137137 for _ , ctype := range ctypes {
138- for hid , header := range ah .mheaders {
138+ for hid , header := range ah .MHeaders {
139139 mtype , err := ParseMediaType (ctype )
140140 if err != nil {
141141 continue
@@ -149,7 +149,7 @@ func (ah AcceptHeader) Negotiate(ctypes []string, dtype string) (accept MimeHead
149149 }
150150
151151 if mhid >= 0 {
152- return ah .mheaders [mhid ], parsedCType .String (), true
152+ return ah .MHeaders [mhid ], parsedCType .String (), true
153153 }
154154
155155 return MimeHeader {}, dtype , false
0 commit comments