AaronErhardt / actix-governor

A middleware for actix-web that provides rate-limiting backed by governor.
GNU General Public License v3.0
103 stars 21 forks source link

TooManyRequests error #19

Closed TheAwiteb closed 2 years ago

TheAwiteb commented 2 years ago

The TooManyRequests error is returned as a text, which is not good for middleware in the API. Is it better to add a feature called json_response or make it a method like with_headers?

TheAwiteb commented 2 years ago

I mean this

image

AaronErhardt commented 2 years ago

I think this could be added to the API. We could allow users to specify a function that returns a response body for the rejected response. This could then be a custom JSON, XML, HTML or whatever you want. We could also add a standard JSON function to make it a bit easier to use.

TheAwiteb commented 2 years ago

Ok i'll worked on. Can you review the headers #18, I'm done with it