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

Add "GetString" method for Args #1376

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xiaojun207
Copy link

Add "GetString" method for Args

@erikdubbelboer
Copy link
Collaborator

What is the reason you want to add this method? Why can't users of fasthttp just do string(a.Peek(key)) themselves?

@xiaojun207
Copy link
Author

xiaojun207 commented Sep 15, 2022

What is the reason you want to add this method? Why can't users of fasthttp just do string(a.Peek(key)) themselves?

  1. For most http frameworks, the preferred method for parameter acquisition is Get or GetString, which helps users use fasthttp. For example, go gin: (c * gin. Context) GetString (key string) (s string), https://stackoverflow.com/questions/39265978/get-a-request-parameter-key-value-in-fasthttp

image

  1. When using fasthttp to receive input parameters, there are many string types used, so GetString is used frequently.

I really hope to pass, thank you

@erikdubbelboer
Copy link
Collaborator

erikdubbelboer commented Sep 15, 2022

But there are no other methods that return strings. Everything returns bytes to prevent allocations. If this is too difficult for someone they really shouldn't be using fasthttp.

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.

2 participants