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

Events API uses consistent error codes #19246

Merged
merged 3 commits into from
Feb 20, 2023
Merged

Conversation

tomhjp
Copy link
Contributor

@tomhjp tomhjp commented Feb 17, 2023

A couple of small tweaks for consistency:

  • UseProtoNames when serializing JSON fields to ensure we use underscores instead of proto3's default camel case to make us consistent with the rest of the Vault API. EDIT: Superseded by events: WS protobuf messages should be binary #19232 which changed to returning the cloud events formatted version of the event. I kept the additional test coverage though.
  • Return 403 for unauthorized requests

For illustration on the status codes:

$ curl --fail -H "X-Vault-Token: $(vault token create -policy=default -field=token)" http://127.0.0.1:8200/v1/sys/mounts
curl: (22) The requested URL returned error: 403

$ curl --fail http://127.0.0.1:8200/v1/sys/mounts
curl: (22) The requested URL returned error: 403

Copy link
Contributor

@swenson swenson left a comment

Choose a reason for hiding this comment

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

LGTM

 Conflicts:
	http/events.go
	http/events_test.go
@tomhjp tomhjp merged commit 4c11d09 into main Feb 20, 2023
@tomhjp tomhjp deleted the events-api-json-and-status branch February 20, 2023 16:24
@tomhjp tomhjp changed the title Events API uses consistent JSON serialization and error codes Events API uses consistent error codes Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants