When using an Assign Message policy including something like:
<Set> <Payload contentType="application/json" variablePrefix="@" variableSuffix="#"> {"name":"foo", "type":"@request.header.user-agent#"} </Payload> </Set>
the result is that special JSON characters are not encoded, e.g., double quotes:
$ nc -l 1111 POST /post HTTP/1.1 Host: localhost:1111 Accept: */* User-Agent: foo"bar Content-Length: 46 Content-Type: application/json {"name":"foo", "type":"foo"bar"}
Is there some alternative mechanism that we should use to encode JSON when using AssignMessage/ServiceCallout? I know we could add another Javascript policy to do it prior to this one to handle the encoding, but there's got to be a better way, right?
We're using OPDK 4.15.07.00
Hello @Eric Dahl,
I tried with the escape char in the request and I am able to achieve the encoded value.
{
"name": "foo",
"type": "foo\"bar"
}
I am not quite sure about the use case, but do not think, there is an way other than a JS code.
User | Count |
---|---|
5 | |
2 | |
1 | |
1 | |
1 |