-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
🚀 Human readable BodyLimit #1874
Comments
would treat the outside integer numbers are perfect for config, everything else must be converted from outside i.e. best you build a function that parses this or we could provide something in the utils, but in the config i wouldn't anchor it additionally |
@ReneWerner87 Fine. Maybe we can provide some function into Config, like ParseBodyLimit() as utility? Sorry for my persistence. I'm just starting my journey into golang development. |
Or you mean utils package? |
converting does not really have anything to do with the bodylimit we could provide a function in the utils called "ConvertToBits". func ConvertToByte(humanReadbleBytes string) int maybe here https://github.com/gofiber/fiber/blob/master/utils/common.go |
Sounds good! |
utils.ConvertToByte("42MB") // 4194304
utils.ConvertToByte("42MegaByte") // 4194304
utils.ConvertToByte("42MByte") // 4194304 |
sure, but don´t forget |
@ReneWerner87 #1875 |
Looks good, will merge it soon |
Tnx! Maybe I will be a good golang developer :) |
@vanodevium How do you use this function? There's no documentation about it. I tried:
They all return function is "undefined" |
It's not released yet But it's coming in the next days. |
Thank you! 👍🏻 |
Is your feature request related to a problem?
No
Describe the solution you'd like
What about make ability to set body size limit as human readable string?
Say we have environment variable
BODY_SIZE=42MB
Then we read and set it to the fiber configuration.
Lets imagine BodyLimitString property in the fiber.Config
And this property automatic parsed into bytes size
The text was updated successfully, but these errors were encountered: