-
Notifications
You must be signed in to change notification settings - Fork 70
Using the mock service with CORS
Beth Skurrie edited this page Jan 12, 2015
·
13 revisions
If your application will be making CORS requests in real life, then stub the OPTIONS request the way you would stub a normal request.
some_provider
.upon_receiving("a CORS request for /something")
.with(method: 'options', path: '/something', headers: {
'Access-Control-Request-Headers' => 'Content-Type',
....
})
.will_respond_with(
status: 200,
headers: {
'Access-Control-Allow-Origin' => '....',
'Access-Control-Allow-Headers' => 'Content-Type',
'Access-Control-Allow-Methods' => 'PUT, POST....'
}
)