mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-14 15:56:44 +03:00
Access host and contentType directly in Request.ParseURI() and Request.ParsePostArgs()
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user