-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set default Content-Type to application/json
- add Content-Type via lua script only when it has no value - setting Content-Type in modifier/martian is no longer necesary Type: Bugfix JIRA: DEP-682 Signed-off-by: jmasar <[email protected]>
- Loading branch information
jmasar
committed
Feb 1, 2024
1 parent
9d18ce6
commit 15d92e0
Showing
9 changed files
with
35 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"modifier/lua-endpoint": { | ||
"@comment": "Add header Content-Type with value application/json if no Content-Type value present", | ||
"sources": ["scripts/header_check.lua"], | ||
"allow_open_libs": true, | ||
"pre": "local r = ctx.load(); check_header(r)", | ||
"live": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
"modifier/lua-endpoint": { | ||
"sources": ["scripts/fake_frinx_token.lua"], | ||
"sources": ["scripts/fake_frinx_token.lua", "scripts/header_check.lua"], | ||
"allow_open_libs": true, | ||
"pre": "local r = ctx.load(); fake_token_validate(r);", | ||
"pre": "local r = ctx.load(); fake_token_validate(r); check_header(r)", | ||
"live": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function check_header(request) | ||
local header = request:headers("Content-Type") | ||
|
||
if header == "" then | ||
request:headers("Content-Type", "application/json") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters