Stub snip:----------------------------
"responses": [
{
"is": {
"statusCode": 200,
"headers": {
"Content-Type": "application/json",
"Access-Control-Allow-Headers": "Origin, Content-Type, X-Auth-Token",
"Access-Control-Allow-Methods": "GET, POST, PUT, OPTIONS",
"Access-Control-Allow-Origin": "*"
},
Error:---------------------------------------
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://local.dev.com:9900' is therefore not allowed access.
--
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-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I managed to get it working with this:
{
"predicates": [
{
"equals": {
"method": "OPTIONS"
}
}
],
"responses": [
{
"is": {
"headers": {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, PATCH, DELETE",
"Access-Control-Allow-Headers": "${ALLOW-HEADERS}"
}
},
"_behaviors": {
"copy": [
{
"from": {
"headers": "Access-Control-Request-Headers"
},
"into": "${ALLOW-HEADERS}",
"using": {
"method": "regex",
"selector": ".+"
}
}
]
}
}
]
}
Note that the response contains "Allow" and the request contains "Request" in the header names. I also had to "Access-Control-Allow-Origin": "*" to every response apart from OPTIONS.