This message was deleted.
# general
s
This message was deleted.
👀 1
r
You need to stub the
OPTIONS
request that the browser will make as a preflight request to have the CORS headers:
Copy code
{
  "request": {
    "method": "OPTIONS",
    "urlPath": "/api/v1/project"
  },
  "response": {
    "status": 204,
    "headers": {
      "Access-Control-Allow-Origin": "*",
      "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
      "Access-Control-Allow-Headers": "*"
    }
  }
}
t
You’re probably better off enabling stub CORS rather than trying to set the correct headers yourself. This is either via
Copy code
.stubCorsEnabled(true)
in Java or
--enable-stub-cors
on the CLI
r
Ah, thanks Tom, didn't know WireMock could do it for you
t
A relatively recent addition
l
Thanks