|
56 | 56 | expect(last_response.status).to be 200 |
57 | 57 |
|
58 | 58 | # OPTIONS request from the browser for the request under test |
59 | | - options '/alligators/new', nil, { 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'accept', 'HTTP_ORIGIN' => 'http://localhost:1234' } |
| 59 | + options '/alligators/new', nil, { 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'accept', 'HTTP_ORIGIN' => 'http://localhost:8888' } |
60 | 60 |
|
61 | 61 | # Ensure it allows the browser to actually make the request |
62 | 62 | expect(last_response.status).to eq 200 |
63 | | - expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:1234' |
| 63 | + expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:8888' |
64 | 64 | expect(last_response.headers['Access-Control-Allow-Credentials']).to eq 'true' |
65 | 65 | expect(last_response.headers['Access-Control-Allow-Headers']).to include 'accept' |
66 | 66 | expect(last_response.headers['Access-Control-Allow-Methods']).to include "DELETE, POST, GET, HEAD, PUT, TRACE, CONNECT" |
67 | 67 |
|
68 | 68 | # Make the request |
69 | | - post "/alligators/new", actual_request, { 'HTTP_ACCEPT' => 'application/json', 'HTTP_ORIGIN' => 'http://localhost:1234' } |
| 69 | + post "/alligators/new", actual_request, { 'HTTP_ACCEPT' => 'application/json', 'HTTP_ORIGIN' => 'http://localhost:8888' } |
70 | 70 |
|
71 | 71 | # Ensure that the response we get back was the one we expected |
72 | 72 | # and includes the CORS header |
73 | | - expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:1234' |
| 73 | + expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:8888' |
74 | 74 | expect(last_response.headers['Content-Type']).to eq 'application/json' |
75 | 75 | expect(JSON.parse(last_response.body)).to eq([{ 'name' => 'Mary' }]) |
76 | 76 | end |
|
0 commit comments