Access host and contentType directly in Request.ParseURI() and Request.ParsePostArgs()

This commit is contained in:
Aliaksandr Valialkin
2015-10-22 11:44:04 +03:00
parent db43ebb688
commit d33ef331de
+3 -3
View File
@@ -33,7 +33,7 @@ func (req *Request) ParseURI() {
if req.parsedURI {
return
}
req.URI.Parse(req.Header.peek(strHost), req.Header.RequestURI)
req.URI.Parse(req.Header.host, req.Header.RequestURI)
req.parsedURI = true
}
@@ -45,9 +45,9 @@ func (req *Request) ParsePostArgs() error {
if !req.Header.IsMethodPost() {
return fmt.Errorf("Cannot parse POST args for %q request", req.Header.Method)
}
if !bytes.Equal(req.Header.peek(strContentType), strPostArgsContentType) {
if !bytes.Equal(req.Header.contentType, strPostArgsContentType) {
return fmt.Errorf("Cannot parse POST args for %q Content-Type. Required %q Content-Type",
req.Header.peek(strContentType), strPostArgsContentType)
req.Header.contentType, strPostArgsContentType)
}
req.PostArgs.ParseBytes(req.Body)
req.parsedPostArgs = true