opa icon indicating copy to clipboard operation
opa copied to clipboard

DocFix: Replace http_status with status_code

Open preet-dev opened this issue 1 year ago • 2 comments

Why the changes in this PR are needed?

In the envoy primer doc there are 2 different field names for the optional status_code to be sent when the request is rejected. In the example policy with additional controls it is status_code while in output document it is mentioned as http_status. The former is the correct one.

What are the changes in this PR?

Document change in the envoy policy primer doc to fix the field name for status code to be sent when request is rejected.

preet-dev avatar May 02 '24 06:05 preet-dev

Deploy Preview for openpolicyagent ready!

Name Link
Latest commit 9a2de480f3a5e52dea3e87a953733aeaa1df356c
Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/6634d9ea3cad310007a06ce0
Deploy Preview https://deploy-preview-6729--openpolicyagent.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar May 02 '24 06:05 netlify[bot]

Thank you for your contribution @preet-dev! 😃 Would you mind linking to the relevant envoy documentation specifying status_code as the correct field?

johanfylling avatar May 02 '24 09:05 johanfylling

@johanfylling On this section of the doc (https://www.openpolicyagent.org/docs/latest/envoy-primer/#example-policy-with-additional-controls) it is mentioned as status_code which is correct. However, right below that, in the output document section (https://www.openpolicyagent.org/docs/latest/envoy-primer/#output-document) it is mentioned as http_status.

I actually ended up trying with http_status but that did not work so a more thorough read of the page revealed the right answer for me.

preet-dev avatar May 02 '24 11:05 preet-dev

@preet-dev thanks for looking into this. If you notice the result object in https://www.openpolicyagent.org/docs/latest/envoy-primer/#output-document, it mentions that a key called http_status is expected in the policy decision. status_code is just used as a variable name in the example policy but the policy decision object should have a key called http_status. Here is relevant code for reference.

ashutosh-narkar avatar May 06 '24 16:05 ashutosh-narkar