Skip to content
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

make the API item limit configurable #1543

Merged
merged 1 commit into from Feb 15, 2017

Conversation

robbkidd
Copy link
Contributor

@robbkidd robbkidd commented Feb 13, 2017

Use API_ITEM_LIMIT environment variable to set the upper limit on the number of items to return for API requests to a Supermarket instance.

Defaults to the previously hard-coded value of 100 if the env var is not present. Also, the cookbook internal to the omnibus package has the same default set in the section of the attributes that get set as env vars.

Closes #1542

@robbkidd robbkidd force-pushed the robb/make-api-item-limit-configurable branch from c345342 to 19c4125 Compare February 13, 2017 21:46
Use API_ITEM_LIMIT environment variable to set the upper limit on the
number of items to return for API requests to a Supermarket instance.

Defaults to the previously hard-coded value of 100 if the env var is not
present. Also, the cookbook internal to the omnibus package has the same
default set in the section of the attributes that get set as env vars.

Signed-off-by: Robb Kidd <rkidd@chef.io>
@robbkidd robbkidd force-pushed the robb/make-api-item-limit-configurable branch from 19c4125 to 53d1afa Compare February 13, 2017 21:52
@@ -46,7 +46,7 @@ def error(body, status = 400)
#
def init_params
@start = params.fetch(:start, 0).to_i
@items = [params.fetch(:items, 10).to_i, 100].min
@items = [params.fetch(:items, 10).to_i, item_limit].min
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a part of me that thinks that the API should respond with a 4xx error when an API request has an item value greater than the limit. Then the requestor would get a clear "no soup for you" message instead of wondering why their request did not return their desired number of items.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed but can happen after we release. Can you open an issue for that before this gets released?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #1544 to return an error when an item count is requested greater than the item limit.

@robbkidd
Copy link
Contributor Author

Submitting to the pipeline for a build to test further.

@chef-delivery chef-delivery merged commit 53d1afa into master Feb 15, 2017
@robbkidd robbkidd deleted the robb/make-api-item-limit-configurable branch February 15, 2017 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants