@digitraffic/common 2024.9.24-3 → 2024.9.25-1
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.
@@ -24,16 +24,17 @@ describe("integration tests", () => {
|
|
24
24
|
}
|
25
25
|
},
|
26
26
|
input: {
|
27
|
-
path: () => ({}),
|
28
27
|
params: () => ({
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
h1: "header1",
|
28
|
+
header: {
|
29
|
+
h1: "header1",
|
30
|
+
},
|
33
31
|
querystring: {
|
34
|
-
|
35
|
-
|
36
|
-
}
|
32
|
+
q1: "querystring1",
|
33
|
+
q2: "querystring2"
|
34
|
+
},
|
35
|
+
path: {
|
36
|
+
p1: "path1"
|
37
|
+
},
|
37
38
|
})
|
38
39
|
},
|
39
40
|
util: {
|
@@ -66,7 +67,17 @@ describe("integration tests", () => {
|
|
66
67
|
.addQueryParameter("q1");
|
67
68
|
const t = createTemplate(i);
|
68
69
|
expect(t).toEqual({
|
69
|
-
q1: "
|
70
|
+
q1: "querystring1"
|
71
|
+
});
|
72
|
+
});
|
73
|
+
test("two query parameters", () => {
|
74
|
+
const i = createIntegration()
|
75
|
+
.addQueryParameter("q1")
|
76
|
+
.addQueryParameter("q2");
|
77
|
+
const t = createTemplate(i);
|
78
|
+
expect(t).toEqual({
|
79
|
+
q1: "querystring1",
|
80
|
+
q2: "querystring2"
|
70
81
|
});
|
71
82
|
});
|
72
83
|
test("multivaluequery parameter", () => {
|
@@ -82,8 +93,8 @@ describe("integration tests", () => {
|
|
82
93
|
.passAllQueryParameters();
|
83
94
|
const t = createTemplate(i);
|
84
95
|
expect(t).toEqual({
|
85
|
-
|
86
|
-
|
96
|
+
q1: "querystring1",
|
97
|
+
q2: "querystring2"
|
87
98
|
});
|
88
99
|
});
|
89
100
|
test("path parameter", () => {
|
@@ -108,9 +119,9 @@ describe("integration tests", () => {
|
|
108
119
|
.addHeaderParameter("h1");
|
109
120
|
const t = createTemplate(i);
|
110
121
|
expect(t).toEqual({
|
111
|
-
|
112
|
-
|
113
|
-
|
122
|
+
h1: "header1",
|
123
|
+
q1: "querystring1",
|
124
|
+
q2: "querystring2"
|
114
125
|
});
|
115
126
|
});
|
116
127
|
test("all parameters & parameter - fail", () => {
|
@@ -127,8 +138,8 @@ describe("integration tests", () => {
|
|
127
138
|
const t = createTemplate(i);
|
128
139
|
expect(t).toEqual({
|
129
140
|
p1: "path1",
|
130
|
-
|
131
|
-
|
141
|
+
q1: "querystring1",
|
142
|
+
q2: "querystring2"
|
132
143
|
});
|
133
144
|
});
|
134
145
|
});
|
@@ -88,8 +88,14 @@ export class DigitrafficIntegration {
|
|
88
88
|
// make multivaluequerystring values to array
|
89
89
|
parameterAssignments.push(`#set($tmp = $paramMap.put('_${parameter.name}', $util.parseJson($method.request.multivaluequerystring['${parameter.name}'])))`);
|
90
90
|
}
|
91
|
+
else if (parameter.type === "path") {
|
92
|
+
parameterAssignments.push(`#set($tmp = $paramMap.put('${parameter.name}', $util.escapeJavaScript($input.params().path['${parameter.name}'])))`);
|
93
|
+
}
|
94
|
+
else if (parameter.type === "header") {
|
95
|
+
parameterAssignments.push(`#set($tmp = $paramMap.put('${parameter.name}', $util.escapeJavaScript($input.params().header['${parameter.name}'])))`);
|
96
|
+
}
|
91
97
|
else {
|
92
|
-
parameterAssignments.push(`#set($tmp = $paramMap.put('${parameter.name}', $util.escapeJavaScript($
|
98
|
+
parameterAssignments.push(`#set($tmp = $paramMap.put('${parameter.name}', $util.escapeJavaScript($params['${parameter.name}'])))`);
|
93
99
|
}
|
94
100
|
});
|
95
101
|
// parameters starting with _ will be handled as json, and will not be in quotes
|