tapir icon indicating copy to clipboard operation
tapir copied to clipboard

Is there a simple way to limit upload body size

Open strokyl opened this issue 2 years ago • 2 comments

I currently have an endpoint taking an input of type multipartBody for allowing my user to upload a file. But I would like to limit the max size in a way that my server cut the request before downloading more. I found the following information:

  • https://gitter.im/softwaremill/tapir?at=5fea4780c746c6431ce049a0
  • https://github.com/softwaremill/tapir/pull/915 But there are a bit outdated. Is there an easy way to do that today? If not do you think contributing such a feature would be easy?

strokyl avatar Nov 25 '22 16:11 strokyl

Some servers allow that at the server-settings level, but there's no tapir-wide setting for that (at least yet). Which server are you using?

adamw avatar Nov 26 '22 09:11 adamw

http4s and yes I found EntityLimiter middleware, but I found it hard to apply to a single endpoint.

strokyl avatar Nov 26 '22 16:11 strokyl