fasthttp icon indicating copy to clipboard operation
fasthttp copied to clipboard

Add "GetString" method for Args

Open xiaojun207 opened this issue 2 years ago • 3 comments

Add "GetString" method for Args

xiaojun207 avatar Sep 14 '22 05:09 xiaojun207

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

erikdubbelboer avatar Sep 14 '22 17:09 erikdubbelboer

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

  2. 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

xiaojun207 avatar Sep 15 '22 02:09 xiaojun207

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.

erikdubbelboer avatar Sep 15 '22 19:09 erikdubbelboer