Skip to content

Commit

Permalink
Merge pull request #7 from zazuko/body-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode authored Feb 7, 2025
2 parents c7a412c + b16fa6b commit 79c2a69
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-bikes-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"api-tuner": patch
---

Exit code was '0' when the eye process fail
5 changes: 5 additions & 0 deletions .changeset/flat-snails-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"api-tuner": patch
---

Temporary request body file was not removed
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ jobs:
node-version: lts/*
- uses: fabasoad/setup-prolog-action@v1
- run: npm ci
- run: docker compose up -d
- run: npx wait-on http-get://localhost:1080/example.com
- run: npm test
shell: bash
- run: if [[ `git status --porcelain` ]]; then git status --porcelain && exit 1; fi
lint:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions bin/tuner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,5 @@ for path in "${PATHS[@]}"; do
cat "$path" >> "$MERGED"
done

set -o pipefail
$eye $ARGS "${SCRIPT_PATH}"/../rules/*.n3 "${MERGED}" | $SUMMARY
11 changes: 7 additions & 4 deletions rules/requests.n3
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ prefix earl: <http://www.w3.org/ns/earl#>
) string:concatenation ?command .

?command^tuner:trace .
?command!e:exec .
{
?command!e:exec .
} log:callWithCleanup {
{
( { ?requestBodyFile log:rawType log:Literal } { ?requestBodyFile!file:rm } true ) log:ifThenElseIn [] .
} log:callWithCleanup true .
} .

(
"node " "lib/merge-curl-output.js"!file:libPath " "
Expand All @@ -72,9 +78,6 @@ prefix earl: <http://www.w3.org/ns/earl#>
("file://" ?responseFile)!string:concatenation^log:uri log:semantics ?res .
?res^tuner:trace .
} log:callWithCleanup {
{
( { ?requestBodyFile log:rawType log:Literal } { ?requestBodyFile!file:rm } true ) log:ifThenElseIn [] .
} log:callWithCleanup true .
{ ?responseHeadersFile!file:rm } log:callWithCleanup true .
{ ?responseBodyFile!file:rm } log:callWithCleanup true .
{ ?responseFile!file:rm } log:callWithCleanup true .
Expand Down
2 changes: 1 addition & 1 deletion tests/failed-requests.n3
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>
true log:equalTo false .
}
{
"if [[ `git status --porcelain` ]]; then exit 1; fi" e:exec 0 .
"if git status --porcelain | grep .; then exit 1; fi" e:exec 0 .
}
) log:ifThenElseIn [] .
} => {
Expand Down

0 comments on commit 79c2a69

Please sign in to comment.