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

Fixing returns error type #24

Closed TheAwiteb closed 2 years ago

TheAwiteb commented 2 years ago

Will closes #23

AaronErhardt commented 2 years ago

I understand the idea, but it's still debatable whether this is desired or should be changed in the extract method.

Some would say that it's a server error if the key can't be extracted, in other cases it has to do with authorization. This should probably be up to the KeyExtractor implementation to figure this out. If extract returned Result<Self::Key, actix_web::Error>, the key extractor would be in charge of setting the correct behavior which IMO would be the better solution.

TheAwiteb commented 2 years ago

I think that it's good, response_error method will use it when extract failed

TheAwiteb commented 2 years ago

it's missing a tests, i will add it, don't merge it

TheAwiteb commented 2 years ago

Is it ready to merge?

Yes ready 🎉

AaronErhardt commented 2 years ago

Alright, thanks for your contribution!