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

Fail request if api_key is not valid. #116

Merged
merged 5 commits into from
Feb 22, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,10 @@ void Aggregated::Check(
if (status.ok()) {
Status status = Proto::ConvertCheckResponse(
*response, service_control_proto_.service_name(), &response_info);
// If allow_unregistered_calls is true, it is always OK to proceed.
if (allow_unregistered_calls) {
// When allow_unregistered_calls is true, it is always OK to proceed if
Copy link
Contributor

Choose a reason for hiding this comment

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

If server replied with either invalid api_key or not actived service, the request is failed even allow_unregistered_calls is true.
Most likely, users provide a wrong api key. By failing the request, the users will be notified with the error and have chance to correct it.
Otherwise, the Report call will fail. It is very hard to notice and debug the Report failure.

Copy link
Contributor

Choose a reason for hiding this comment

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

please add above comment

// the api_key is valid and service is activated.
if (allow_unregistered_calls && response_info.is_api_key_valid &&
response_info.service_is_activated) {
on_done(Status::OK, response_info);
} else {
on_done(status, response_info);
Expand Down