api-tuner 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rules/curl-body.n3 +33 -11
- package/rules/files.n3 +1 -1
- package/rules/requests.n3 +32 -28
package/package.json
CHANGED
package/rules/curl-body.n3
CHANGED
|
@@ -38,17 +38,8 @@ prefix math: <http://www.w3.org/2000/10/swap/math#>
|
|
|
38
38
|
(
|
|
39
39
|
?formField
|
|
40
40
|
{
|
|
41
|
-
?multipartBody tuner:form
|
|
42
|
-
|
|
43
|
-
(
|
|
44
|
-
{ ?value log:rawType log:Literal }
|
|
45
|
-
{
|
|
46
|
-
( " -F " ?name "=" ?value ) string:concatenation ?formField .
|
|
47
|
-
}
|
|
48
|
-
{
|
|
49
|
-
( " -F " ?name "=" ?value!file:curlFileReference ) string:concatenation ?formField .
|
|
50
|
-
}
|
|
51
|
-
) log:ifThenElseIn [] .
|
|
41
|
+
?multipartBody tuner:form ?list .
|
|
42
|
+
?list </#field> ?formField .
|
|
52
43
|
}
|
|
53
44
|
?formFields
|
|
54
45
|
) log:collectAllIn [] .
|
|
@@ -57,3 +48,34 @@ prefix math: <http://www.w3.org/2000/10/swap/math#>
|
|
|
57
48
|
?formFields!string:concatenation
|
|
58
49
|
) string:concatenation ?curlArgs .
|
|
59
50
|
} .
|
|
51
|
+
|
|
52
|
+
{
|
|
53
|
+
( ?name ?value ) </#field> ?formField .
|
|
54
|
+
} <= {
|
|
55
|
+
{
|
|
56
|
+
?value log:rawType log:Literal .
|
|
57
|
+
( " -F " ?name "=" ?value ) string:concatenation ?formField .
|
|
58
|
+
} log:callWithCut true .
|
|
59
|
+
} .
|
|
60
|
+
|
|
61
|
+
{
|
|
62
|
+
( ?name ?value ) </#field> ?formField .
|
|
63
|
+
} <= {
|
|
64
|
+
( ?name ?value "" ) </#field> ?formField .
|
|
65
|
+
} .
|
|
66
|
+
|
|
67
|
+
{
|
|
68
|
+
( ?name ?value ?type ) </#field> ?formField .
|
|
69
|
+
} <= {
|
|
70
|
+
(
|
|
71
|
+
{ ?type!string:length math:greaterThan 0 }
|
|
72
|
+
{
|
|
73
|
+
( "';type=" ?type "'" ) string:concatenation ?typeParam
|
|
74
|
+
}
|
|
75
|
+
{
|
|
76
|
+
?typeParam log:equalTo "" .
|
|
77
|
+
}
|
|
78
|
+
) log:ifThenElseIn [] .
|
|
79
|
+
|
|
80
|
+
( " -F " ?name "=" ?value!file:curlFileReference ?typeParam ) string:concatenation ?formField .
|
|
81
|
+
} .
|
package/rules/files.n3
CHANGED
package/rules/requests.n3
CHANGED
|
@@ -42,37 +42,41 @@ prefix earl: <http://www.w3.org/ns/earl#>
|
|
|
42
42
|
( ?responseBodyFile ".curl.json" ) string:concatenation ?responseHeadersFile .
|
|
43
43
|
( ?responseBodyFile ".n3" ) string:concatenation ?responseFile .
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
(
|
|
48
|
-
{ ?req tuner:body ?body }
|
|
49
|
-
{ ?body </#body> ( ?bodyArgs ?requestBodyFile ) }
|
|
50
|
-
{ ?bodyArgs log:equalTo "" }
|
|
51
|
-
) log:ifThenElseIn [] .
|
|
45
|
+
{
|
|
46
|
+
( "Calling " ?method " " ?endpoint )!string:concatenation^tuner:info .
|
|
52
47
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
" -o " ?responseBodyFile
|
|
59
|
-
" > " ?responseHeadersFile
|
|
60
|
-
) string:concatenation ?command .
|
|
48
|
+
(
|
|
49
|
+
{ ?req tuner:body ?body }
|
|
50
|
+
{ ?body </#body> ( ?bodyArgs ?requestBodyFile ) }
|
|
51
|
+
{ ?bodyArgs log:equalTo "" }
|
|
52
|
+
) log:ifThenElseIn [] .
|
|
61
53
|
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
(
|
|
55
|
+
"curl -s -X " ?method " '" ?endpoint "'"
|
|
56
|
+
?headersArgs
|
|
57
|
+
?bodyArgs
|
|
58
|
+
" -w @" ( "lib/curl-format.txt"!file:libPath )!string:concatenation
|
|
59
|
+
" -o " ?responseBodyFile
|
|
60
|
+
" > " ?responseHeadersFile
|
|
61
|
+
) string:concatenation ?command .
|
|
64
62
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
?responseBodyFile
|
|
68
|
-
" > " ?responseFile
|
|
69
|
-
)!string:concatenation!e:exec .
|
|
63
|
+
?command^tuner:trace .
|
|
64
|
+
?command!e:exec .
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
(
|
|
67
|
+
"node " "lib/merge-curl-output.js"!file:libPath " "
|
|
68
|
+
?responseBodyFile
|
|
69
|
+
" > " ?responseFile
|
|
70
|
+
)!string:concatenation!e:exec .
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
("file://" ?responseFile)!string:concatenation^log:uri log:semantics ?res .
|
|
73
|
+
?res^tuner:trace .
|
|
74
|
+
} log:callWithCleanup {
|
|
75
|
+
{
|
|
76
|
+
( { ?requestBodyFile log:rawType log:Literal } { ?requestBodyFile!file:rm } true ) log:ifThenElseIn [] .
|
|
77
|
+
} log:callWithCleanup true .
|
|
78
|
+
{ ?responseHeadersFile!file:rm } log:callWithCleanup true .
|
|
79
|
+
{ ?responseBodyFile!file:rm } log:callWithCleanup true .
|
|
80
|
+
{ ?responseFile!file:rm } log:callWithCleanup true .
|
|
81
|
+
} .
|
|
78
82
|
} .
|