Closed ghost closed 5 years ago
Managed to get it working with
java -Dmockserver.enableCORSForAPI=false -jar "./test/mockserver-netty-5.3.0-jar-with-dependencies.jar" -serverPort 3010
-Dmockserver.enableCORSForAPI=false
I found the answer here: https://github.com/jamesdbloom/mockserver/issues/429
The arguments you can pass are almost the same, pretty easy to miss where you've gone wrong.
The documentation has been updated so closing issue
Hi,
I'm running the mock server standalone (also tried running the version installed with homebrew), then I'm using the JavaScript client to set expectations:
I have tried lots of different options to disable CORS when booting the mock server, but I still seem to get responses back with the
X-CORS
header, along with the default headers that are added when CORS is switched on, and all of my headers specified in the expectation are missing.I have tried booting the mock server in different way to disable CORS:
But I'm still getting the mock server CORS headers. Am I missing something?
Everything else seems to be working. Sending the requests in Postman respond with what is defined in the expectation.
I'm starting to believe there might be something wrong with the CORS stuff when using the JavaScript client, but it may also be something I'm doing wrong. I need help!
It's also worth mentioning that when I send the request in Postman, I can see the log in the terminal and mock server is telling me it's received a request and is responding. But when the request is sent by the browser, the terminal doesn't tell me anything. The request is still going to mock server though because it's adding the
X-CORS: MockServer CORS support enabled by default ...
header. I'm not sure if this is related or if it helps, just something I've noticed.