Skip to content

Commit

Permalink
Policy: Payload request/response limits fixes.
Browse files Browse the repository at this point in the history
- Change policy name.
- Fixed some typos.
- Added description fields on jsonschema form.

Signed-off-by: Eloy Coto <eloy.coto@acalustra.com>
  • Loading branch information
eloycoto committed Oct 9, 2020
1 parent 9f55b79 commit cbb27ef
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 32 deletions.
21 changes: 0 additions & 21 deletions gateway/src/apicast/policy/limits/Readme.md

This file was deleted.

1 change: 0 additions & 1 deletion gateway/src/apicast/policy/limits/init.lua

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Request/response size limits policy
# Request/response payload size limits policy

This policy allows users to limit the size of the request and the response.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"request": {
"type": "integer",
"title": "The request limit in bytes",
"description": "Request limit in bytes, 0 allows all",
"default": 0,
"minimum": 0,
"examples": [
Expand All @@ -25,6 +26,7 @@
"response": {
"type": "integer",
"title": "The response limit in bytes",
"description": "Response limit in bytes, 0 allows all",
"default": 0,
"minimum": 0,
"examples": [
Expand Down
1 change: 1 addition & 0 deletions gateway/src/apicast/policy/payload_limits/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
return require("payload_limit")
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
local _M = require('apicast.policy').new('Logging Policy', 'builtin')
local _M = require('apicast.policy').new('Payload size policy', 'builtin')
local new = _M.new

local ngx_print = ngx.print
local ngx_exit = ngx.exit
local ngx_say = ngx.say

Expand Down
13 changes: 6 additions & 7 deletions t/apicast-policy-limits.t → t/apicast-policy-payload_limits.t
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ __DATA__
],
"policy_chain": [
{
"name": "apicast.policy.limits",
"name": "apicast.policy.payload_limits",
"configuration": {
"request": 0,
"response": 0
Expand Down Expand Up @@ -94,7 +94,7 @@ yay, api backend
],
"policy_chain": [
{
"name": "apicast.policy.limits",
"name": "apicast.policy.payload_limits",
"configuration": {
"request": 100,
"response": 0
Expand Down Expand Up @@ -128,7 +128,6 @@ Payload Too Large
=== TEST 3: Request body size smaller than the limit
-- ONLY
--- backend
location /transactions/authrep.xml {
content_by_lua_block {
Expand All @@ -150,7 +149,7 @@ Payload Too Large
],
"policy_chain": [
{
"name": "apicast.policy.limits",
"name": "apicast.policy.payload_limits",
"configuration": {
"request": 10000000,
"response": 0
Expand Down Expand Up @@ -205,7 +204,7 @@ yay, api backend
],
"policy_chain": [
{
"name": "apicast.policy.limits",
"name": "apicast.policy.payload_limits",
"configuration": {
"request": 0,
"response": 100
Expand Down Expand Up @@ -265,7 +264,7 @@ POST /test
],
"policy_chain": [
{
"name": "apicast.policy.limits",
"name": "apicast.policy.payload_limits",
"configuration": {
"request": 0,
"response": 1000000
Expand Down Expand Up @@ -295,7 +294,7 @@ POST /test
}
--- request eval
"POST /test \n"
"POST /test \n"
--- error_code: 200
--- no_error_log
[error]

0 comments on commit cbb27ef

Please sign in to comment.