Skip to content

Commit 33008be

Browse files
committed
JSON escaping
1 parent 08b249c commit 33008be

17 files changed

Lines changed: 22 additions & 22 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ api:
5858
- template:
5959
src: |
6060
{
61-
"sub": "${fn.user()}"
61+
"sub": ${fn.toJSON(fn.user())}
6262
}
6363
- jwtSign:
6464
jwk:
@@ -716,7 +716,7 @@ api:
716716
contentType: application/json
717717
src: |
718718
{
719-
"destination": "${json.city}"
719+
"destination": ${fn.toJSON(json.city)}
720720
}
721721
- return:
722722
status: 200

distribution/examples/extending-membrane/if/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ A common use case of the `if` plugin is the manipulation of responses based on t
5151
<template pretty="yes" contentType="application/json">
5252
{
5353
"type": "https://membrane-api.io/error/",
54-
"title": "${exc.response.statusMessage}"
54+
"title": ${fn.toJSON(exc.response.statusMessage)}
5555
}
5656
</template>
5757
</if>

distribution/examples/extending-membrane/if/apis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ api:
5555
src: |
5656
{
5757
"type": "https://membrane-api.io/error/",
58-
"title": "${exc.response.statusMessage}",
58+
"title": ${fn.toJSON(exc.response.statusMessage)},
5959
"status": ${exc.response.statusCode}
6060
}
6161
- if:

distribution/examples/extending-membrane/if/proxies.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<template pretty="yes" contentType="application/json">
3939
{
4040
"type": "https://membrane-api.io/error/",
41-
"title": "${exc.response.statusMessage}",
41+
"title": ${fn.toJSON(exc.response.statusMessage)},
4242
"status": ${exc.response.statusCode}
4343
}
4444
</template>

distribution/examples/orchestration/call-post/apis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ api:
1818
contentType: application/json
1919
src: |
2020
{
21-
"name": "${property.name} Big Pack",
21+
"name": ${fn.toJSON(property.name + ' Big Pack')},
2222
"price": ${property.price}
2323
}
2424
- call:

distribution/examples/orchestration/call-post/proxies.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<!-- Creates a new JSON body with the name and modified price -->
1616
<template contentType="application/json">
1717
{
18-
"name": "${property.name} Big Pack",
18+
"name": ${fn.toJSON(property.name + ' Big Pack')},
1919
"price": ${property.price}
2020
}
2121
</template>

distribution/examples/orchestration/for-loop/apis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ api:
3030
"products": [
3131
<% property.result.eachWithIndex { p, idx -> %>
3232
{
33-
"name": "${p.name}",
33+
"name": ${fn.toJSON(p.name)},
3434
"price": ${p.price}
3535
}${idx < property.result.size() - 1 ? ',' : ''}
3636
<% } %>

distribution/examples/security/jwt/apikey-to-jwt-conversion/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The resulting JWT is stored in the body and returned via `<return>`.
3838
{
3939
"sub": "user@example.com",
4040
"aud": "order",
41-
"scope": "${property.scopes}"
41+
"scope": ${fn.toJSON(property.scopes)}
4242
}
4343
</template>
4444
<jwtSign>

distribution/examples/security/jwt/apikey-to-jwt-conversion/apis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ api:
2020
{
2121
"sub": "user@example.com",
2222
"aud": "order",
23-
"scope": "${property.scopes}"
23+
"scope": ${fn.toJSON(property.scopes)}
2424
}
2525
- jwtSign:
2626
jwk:

distribution/examples/security/jwt/apikey-to-jwt-conversion/proxies.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{
1919
"sub": "user@example.com",
2020
"aud": "order",
21-
"scope": "${property.scopes}"
21+
"scope": ${fn.toJSON(property.scopes)}
2222
}
2323
</template>
2424
<jwtSign>

0 commit comments

Comments
 (0)