-
Notifications
You must be signed in to change notification settings - Fork 73
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
Rate limiting updates #141
base: master
Are you sure you want to change the base?
Conversation
abaevbog
commented
Jun 5, 2023
•
edited
Loading
edited
- Using $this->end() instead of exit in controllers. It ensures that concurrency rate limiter counts requests as finished.
- Make client wait for full capacity once rate limit is reached.
So, getting rid of |
controllers/MappingsController.php
Outdated
@@ -34,7 +34,9 @@ public function mappings() { | |||
$locale = !empty($_GET['locale']) | |||
? \Zotero\Schema::resolveLocale($_GET['locale']) | |||
: 'en-US'; | |||
|
|||
unset($this->queryParams['format']); | |||
header("Content-Type: application/json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these lines necessary? format
defaults to JSON, so I would think that outputContentType()
in end()
would get it right. I think we were only calling header()
because we weren't using end()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, these 2 lines can actually be removed.
The same 2 lines in the newItem
function are still needed to get the right application/json content type for API v2
controllers/MappingsController.php
Outdated
|
||
|
||
unset($this->queryParams['format']); | ||
header("Content-Type: application/json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just set 'json' as the default format
for the mappings actions for v1/v2 in API.inc.php?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. That is definitely cleaner