Skip to content

Commit

Permalink
document stubbing out OPTIONS request in README
Browse files Browse the repository at this point in the history
  • Loading branch information
rimian committed Apr 11, 2016
1 parent 09c3380 commit 2d21e66
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ proxy.stub('http://example.com/api', :method => 'post').and_return(
:headers => { 'Access-Control-Allow-Origin' => '*' },
:code => 201
)

# Stub out an OPTIONS request. Set the headers to the values you require.
proxy.stub(url, :method => :options).and_return(
:headers => {
'Access-Control-Allow-Methods' => 'GET, PATCH, POST, PUT, OPTIONS',
'Access-Control-Allow-Headers' => 'X-Requested-With, X-Prototype-Version, Content-Type',
'Access-Control-Allow-Origin' => '*'
},
:code => 200
)
```

Stubs are reset between tests. Any requests that are not stubbed will be
Expand Down

0 comments on commit 2d21e66

Please sign in to comment.