-
Notifications
You must be signed in to change notification settings - Fork 2.8k
test(http-logger): fetch request and response body test case #6487
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
test(http-logger): fetch request and response body test case #6487
Conversation
t/lib/server.lua
Outdated
| end | ||
| end | ||
|
|
||
| local function str_split(str, reps) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add the mock API in the test file like:
apisix/t/plugin/clickhouse-logger.t
Line 39 in 4feab8e
| location /clickhouse-logger/test { |
It's not commonly used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| query = {query} | ||
| end | ||
| local data, err = require("cjson").decode(body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, Why do we need to decode the body?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log format data is JSON, and we need to get the information in the structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
t/plugin/http-logger2.t
Outdated
| val = val[key] | ||
| end | ||
| end | ||
| ngx.log(ngx.ERR ,query[i], ":", val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use WARN log level
t/plugin/http-logger2.t
Outdated
| }, | ||
| "uri": "/http-logger/test" | ||
| }]], | ||
| [[{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove the response body check
What this PR does / why we need it:
FIX https://the-asf.slack.com/archives/CUC5MN17A/p1646136677114399
Pre-submission checklist: