I am having difficulty adding the method PATCH to MockServer.
I use the curl request below and the expectation is created properly.
While testing I receive the following error.
Method PATCH is not allowed by Access-Control-Allow-Methods in preflight response.
I am using the docker container and I am starting the container with the following command.
docker run -p 1080:1080 jamesdbloom/mockserver
/opt/mockserver/run_mockserver.sh
-logLevel INFO -serverPort 1080
-genericJVMOptions '-Dmockserver.enableCORSForAllResponses=false'
I have also tried
docker run -p 1080:1080 jamesdbloom/mockserver
/opt/mockserver/run_mockserver.sh
-logLevel INFO -serverPort 1080
-genericJVMOptions '-Dmockserver.enableCORSForAllResponses=true
curl -v -X PUT "http://localhost:1080/expectation" -d '{
"httpRequest": {
"method": "PATCH",
"path": "/settings",
"headers": {
"Host": [".*"],
"Connection": ["keep-alive"],
"Origin": [".*"],
"User-Agent": [".*"],
"Access-Control-Request-Method": ["PATCH"],
"access-control-request-headers": ["access-control-allow-origin,content-type"],
"Accept.*": [".*"],
"content-length": [".*"]
},
"body": {
"type": "PARAMETERS",
"parameters":
{
"email": ["user@example.com"],
"name": ["User Name"],
"password": ["supersecret"],
"password_confirmation": ["supersecret"],
"username": ["emanresu"]
}
}
},
"httpResponse": {
"statusCode": 200,
"headers": {
"Content-Type": ["application/json"],
"Server": ["nginx/1.13.12"],
"Access-Control-Allow-Origin": ["*"],
"Access-Control-Allow-Methods" : ["GET, HEAD, OPTIONS, POST, PUT, PATCH"],
"Access-Control-Allow-Headers" : ["Access-Control-Allow-Origin, Authorization, Access-Control-Allow-Headers, Origin, Accept, X-Requested-With, Content-Type, Access-Control-Allow-Methods, Access-Control-Request-Method, Access-Control-Request-Headers"],
"Access-Control-Expose-Headers": ["Access-Control-Allow-Origin, Authorization, Access-Control-Allow-Headers, Origin, Accept, X-Requested-With, Content-Type, Access-Control-Allow-Methods, Access-Control-Request-Method, Access-Control-Request-Headers"],
"Access-Control-Max-Age": ["300"],
"connection": ["close"]
},
"body": "{\"status\":\"success\"}"
}
}'