Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for fasthttp #2

Closed
wants to merge 1 commit into from
Closed

Conversation

flyhard
Copy link

@flyhard flyhard commented Dec 29, 2020

Should solve #1

downside is, I broke old code since I moved the code to different packages

Copy link

@GitOpsBot GitOpsBot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GoGitOps Review

Grade: A (88.2%)

Files: 6

Issues: 3

gofmt: 100%

go_vet: 100%

golint: 50%

contenttype.go
	Line 8: warning: exported var ErrInvalidMediaType should have comment or be unexported (golint)
contenttype.go
	Line 9: warning: exported var ErrInvalidMediaRange should have comment or be unexported (golint)
contenttype.go
	Line 10: warning: exported var ErrInvalidParameter should have comment or be unexported (golint)
contenttype.go
	Line 11: warning: exported var ErrInvalidExtensionParameter should have comment or be unexported (golint)
contenttype.go
	Line 12: warning: exported var ErrNoAcceptableTypeFound should have comment or be unexported (golint)
contenttype.go
	Line 13: warning: exported var ErrNoAvailableTypeGiven should have comment or be unexported (golint)
contenttype.go
	Line 14: warning: exported var ErrInvalidWeight should have comment or be unexported (golint)
contenttype.go
	Line 16: warning: comment on exported type Parameters should be of the form "Parameters ..." (with optional leading article) (golint)
contenttype.go
	Line 19: warning: comment on exported type MediaType should be of the form "MediaType ..." (with optional leading article) (golint)
contenttype.go
	Line 75: warning: exported function SkipWhiteSpaces should have comment or be unexported (golint)
contenttype.go
	Line 118: warning: exported function ConsumeType should have comment or be unexported (golint)
contenttype.go
	Line 149: warning: exported function ConsumeParameter should have comment or be unexported (golint)
contenttype.go
	Line 193: warning: exported function GetWeight should have comment or be unexported (golint)
contenttype.go
	Line 232: warning: exported function CompareMediaTypes should have comment or be unexported (golint)
contenttype.go
	Line 248: warning: exported function GetPrecedence should have comment or be unexported (golint)
contenttype.go
	Line 262: warning: comment on exported function NewMediaType should be of the form "NewMediaType ..." (golint)
fasthttp/mediatype.go
	Line 8: warning: comment on exported function GetMediaType should be of the form "GetMediaType ..." (golint)
fasthttp/mediatype.go
	Line 48: warning: comment on exported function GetAcceptableMediaType should be of the form "GetAcceptableMediaType ..." (golint)
http/mediatype.go
	Line 9: warning: comment on exported function GetMediaType should be of the form "GetMediaType ..." (golint)
http/mediatype.go
	Line 49: warning: comment on exported function GetAcceptableMediaType should be of the form "GetAcceptableMediaType ..." (golint)

gocyclo: 50%

http/mediatype.go
	Line 51: warning: cyclomatic complexity 26 of function GetAcceptableMediaType() is high (> 15) (gocyclo)
fasthttp/mediatype.go
	Line 50: warning: cyclomatic complexity 26 of function GetAcceptableMediaType() is high (> 15) (gocyclo)
contenttype.go
	Line 41: warning: cyclomatic complexity 17 of function isTokenChar() is high (> 15) (gocyclo)

ineffassign: 100%

license: 100%

misspell: 100%

This report was generated using GoGitOps.

http/mediatype.go Outdated Show resolved Hide resolved
fasthttp/mediatype.go Outdated Show resolved Hide resolved
Copy link

@GitOpsBot GitOpsBot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GoGitOps Review

Grade: A (88.2%)

Files: 4

Issues: 2

gofmt: 100%

go_vet: 100%

golint: 50%

contenttype.go
	Line 9: warning: exported var ErrInvalidMediaType should have comment or be unexported (golint)
contenttype.go
	Line 10: warning: exported var ErrInvalidMediaRange should have comment or be unexported (golint)
contenttype.go
	Line 11: warning: exported var ErrInvalidParameter should have comment or be unexported (golint)
contenttype.go
	Line 12: warning: exported var ErrInvalidExtensionParameter should have comment or be unexported (golint)
contenttype.go
	Line 13: warning: exported var ErrNoAcceptableTypeFound should have comment or be unexported (golint)
contenttype.go
	Line 14: warning: exported var ErrNoAvailableTypeGiven should have comment or be unexported (golint)
contenttype.go
	Line 15: warning: exported var ErrInvalidWeight should have comment or be unexported (golint)
contenttype.go
	Line 17: warning: comment on exported type Parameters should be of the form "Parameters ..." (with optional leading article) (golint)
contenttype.go
	Line 20: warning: comment on exported type MediaType should be of the form "MediaType ..." (with optional leading article) (golint)
contenttype.go
	Line 263: warning: comment on exported function NewMediaType should be of the form "NewMediaType ..." (golint)
contenttype.go
	Line 310: warning: comment on exported function GetMediaType should be of the form "GetMediaType ..." (golint)
contenttype.go
	Line 350: warning: comment on exported function GetAcceptableMediaType should be of the form "GetAcceptableMediaType ..." (golint)
fasthttp.go
	Line 7: warning: comment on exported function GetMediaTypeFastHTTP should be of the form "GetMediaTypeFastHTTP ..." (golint)
fasthttp.go
	Line 47: warning: comment on exported function GetAcceptableMediaTypeFastHTTP should be of the form "GetAcceptableMediaTypeFastHTTP ..." (golint)

gocyclo: 50%

contenttype.go
	Line 352: warning: cyclomatic complexity 26 of function GetAcceptableMediaType() is high (> 15) (gocyclo)
contenttype.go
	Line 42: warning: cyclomatic complexity 17 of function isTokenChar() is high (> 15) (gocyclo)
fasthttp.go
	Line 49: warning: cyclomatic complexity 26 of function GetAcceptableMediaTypeFastHTTP() is high (> 15) (gocyclo)

ineffassign: 100%

license: 100%

misspell: 100%

This report was generated using GoGitOps.

"github.com/valyala/fasthttp"
)

// Gets the content of Content-Type header, parses it, and returns the parsed MediaType

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: comment on exported function GetMediaTypeFastHTTP should be of the form "GetMediaTypeFastHTTP ..." (golint)

return mediaType, nil
}

// Choses a media type from available media types according to the Accept

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: comment on exported function GetAcceptableMediaTypeFastHTTP should be of the form "GetAcceptableMediaTypeFastHTTP ..." (golint)


// Choses a media type from available media types according to the Accept
// Returns the most suitable media type or an error if no type can be selected
func GetAcceptableMediaTypeFastHTTP(request *fasthttp.Request, availableMediaTypes []MediaType) (MediaType, Parameters, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: cyclomatic complexity 26 of function GetAcceptableMediaTypeFastHTTP() is high (> 15) (gocyclo)

@elnormous elnormous closed this May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants