-
Notifications
You must be signed in to change notification settings - Fork 6
[ENGG-4251] feat: index request body via template strings #32
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -18,7 +18,7 @@ export const dummyMock1: Mock = { | |||||
| foo: "bar", | ||||||
| "content-type": "application/json", | ||||||
| }, | ||||||
| body: '{"Hello":"There","mockId":"1", "statusCode": {{ statusCode }}, "method": "{{ method }}", "urlParams": "{{ urlParam \'userId\' }}", "header": "{{ header \'userid\' \'test\' }}" }}', | ||||||
| body: '{"Hello":"There","mockId":"1", "statusCode": {{ statusCode }}, "method": "{{ method }}", "urlParams": "{{ urlParam \'userId\' }}", "header": "{{ header \'userid\' \'test\' }}", body: "{{body \'test\'}}" }', | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick Fix invalid JSON key: quote "body". Unquoted property names make the response body invalid JSON. Apply this diff: - body: '{"Hello":"There","mockId":"1", "statusCode": {{ statusCode }}, "method": "{{ method }}", "urlParams": "{{ urlParam \'userId\' }}", "header": "{{ header \'userid\' \'test\' }}", body: "{{body \'test\'}}" }',
+ body: '{"Hello":"There","mockId":"1", "statusCode": {{ statusCode }}, "method": "{{ method }}", "urlParams": "{{ urlParam \'userId\' }}", "header": "{{ header \'userid\' \'test\' }}", "body": "{{body \'test\'}}" }',📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| }, | ||||||
| ], | ||||||
| }; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| import { Request } from "har-format"; | ||
| import { RequestMethod } from "."; | ||
|
|
||
| export interface MockContextParams { | ||
| urlParams: Record<string, string>; | ||
| method: RequestMethod; | ||
| statusCode: number; | ||
| headers: Record<string, string>; | ||
| data: Request["postData"] | ||
| } | ||
|
Comment on lines
+1
to
10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify har-format is declared in package.json (dev dep is fine). Ensures the type import resolves in CI. Run: 🏁 Script executed: #!/bin/bash
fd -a package.json | xargs -I{} rg -nC2 -H '"har-format"' {}Length of output: 0 🏁 Script executed: #!/bin/bash
set -euo pipefail
found=false
while IFS= read -r -d '' file; do
found=true
echo "=== $file ==="
if command -v rg >/dev/null 2>&1; then
rg -nC2 -H '"har-format"' "$file" || echo "no match in $file"
else
grep -n '"har-format"' "$file" || echo "no match in $file"
fi
done < <(find . -type f -name package.json -print0)
if [ "$found" = false ]; then
echo "no package.json files found"
fiLength of output: 57 🏁 Script executed: #!/bin/bash
set -euo pipefail
# find package.json via git or find
files="$(git ls-files -- package.json 2>/dev/null || true)"
if [ -z "$files" ]; then
files="$(find . -type f -name 'package.json' -print 2>/dev/null || true)"
fi
if [ -z "$files" ]; then
echo "no package.json files found"
exit 0
fi
for f in $files; do
echo "=== $f ==="
if command -v jq >/dev/null 2>&1; then
jq -r '["dependencies","devDependencies","peerDependencies","optionalDependencies"] | .[] as $k | (.[$k] // {}) | keys[]' "$f" 2>/dev/null | sort -u | rg -n --hidden -F 'har-format' || echo "har-format not listed in deps of $f"
else
if grep -q '"har-format"' "$f"; then
echo "har-format entry:"
grep -n '"har-format"' "$f" || true
else
echo "har-format not found in $f"
fi
fi
doneLength of output: 66 Add har-format to package.json (devDependency OK) 🤖 Prompt for AI Agents |
||
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.
Redact or remove logging of contextParams; adding data now risks leaking PII/secrets.
With data included, the existing console.log (Line 42) will emit request bodies and sensitive headers.
Suggested mitigation (replace the current log):
🤖 Prompt for AI Agents