IndraGunawan / api-rate-limit-bundle

Rate limits protection for api-platform resources.
MIT License
66 stars 10 forks source link

Support request methods selection #12

Closed baudev closed 5 years ago

baudev commented 5 years ago

Thanks to this PR, it's possible selecting to which specific methods the rate limit is applied:

/**
 * @ApiResource
 * @ORM\Entity
 * @ApiRateLimit(
 *     enabled=true, 
 *     throttle={
 *         "default"={
 *             "limit"=2,
 *             "period"=10
 *         }
 *     }
 *     },
 *     methods={"GET", "DELETE"}
 * )
 */
class Foo {

}

If the method is not corresponding to the annotation ones (e.g POST), then it's the global configuration rate limit that is applied.

Notes: this PR is based on the following fix: https://github.com/IndraGunawan/api-rate-limit-bundle/pull/11

IndraGunawan commented 5 years ago

Hi @baudev could you please fix the conflict

baudev commented 5 years ago

Please, don't forget pushing a new tag :wink: The last one (v0.2.1) dates back to 2017!

IndraGunawan commented 5 years ago

thanks @baudev