tcp Regex copy behaviour not working

10 views
Skip to first unread message

Bruce Maginnis

unread,
Dec 12, 2021, 1:08:38 PM12/12/21
to mountebank-discuss
Hi,
I've been trying out Copy behaviour with tcp (text), but keep running into the following error

"message":"Cannot assign to read only property '0' of string 'My name is ${groups}[0] ${groups}[1]'","name":"TypeError","stack":"TypeError: Cannot assign to read only property '0' of string 'My name is ${groups}[0] ${groups}[1]'\n
/src/models/behaviors.js:344:22)

Am I mis-configuring?

Thanks

{
"protocol": "tcp",
"port": 8888,
"numberOfRequests": 0,
"recordRequests": true,
"mode": "text",
"requests": [],
"stubs": [
{
"name": "auth",
"predicates": [
{
"matches": { "data": "bruce(.*?)" }
}
],
"responses": [
{
"is" :"My name is ${groups}[0] ${groups}[1]"
,
"behaviors": [
{
"copy": {
"from": "data",
"into": "${groups}",
"using": {
"method": "regex",
"selector": "^(.*?) (.*?)$",
"options": { "ignoreCase": true }
}
}
}]
}]
}
]
}
Message has been deleted

Bruce Maginnis

unread,
Dec 15, 2021, 1:10:08 PM12/15/21
to mountebank-discuss
Figured out this issue, appeared to be in the responses, needed to be
"is" : { "data" : "My name is ${groups}[0] ${groups}[1]" }

Brandon Byars

unread,
Dec 16, 2021, 9:36:32 PM12/16/21
to Bruce Maginnis, mountebank-discuss
Thank you Bruce for reporting back with the solution. 

--
You received this message because you are subscribed to the Google Groups "mountebank-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mountebank-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mountebank-discuss/40f68a03-a151-48c9-9378-e8c70e27db46n%40googlegroups.com.
--
Sent from Gmail Mobile
Reply all
Reply to author
Forward
0 new messages