Skip to content

Commit

Permalink
Updated README with info about matching request body against hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartosz Blimke committed Jun 19, 2010
1 parent 0d44535 commit fb18a01
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions README.md
Expand Up @@ -13,10 +13,13 @@ Features
* Smart matching of the same headers in different representations. * Smart matching of the same headers in different representations.
* Support for Test::Unit * Support for Test::Unit
* Support for RSpec 1.x and RSpec 2.x * Support for RSpec 1.x and RSpec 2.x
* Support for Net::HTTP and other http libraries based on Net::HTTP (i.e RightHttpConnection, rest-client, HTTParty)
* Support for HTTPClient library (both sync and async requests) Supported HTTP libraries
* Support for Patron library ------------------------
* Easy to extend to other HTTP libraries
* Net::HTTP and libraries based on Net::HTTP (i.e RightHttpConnection, rest-client, HTTParty)
* HTTPClient
* Patron


Installation Installation
------------ ------------
Expand Down Expand Up @@ -80,6 +83,20 @@ You can also use WebMock without RSpec or Test::Unit support:
res = Net::HTTP.start(uri.host, uri.port) {|http| res = Net::HTTP.start(uri.host, uri.port) {|http|
http.request(req, 'hello world') http.request(req, 'hello world')
} # ===> Success } # ===> Success

### Matching requests with URL-Encoded, JSON or XML body against hash

stub_http_request(:post, "www.example.com").
with(:body => {:data => {:a => '1', :b => 'five'}})

RestClient.post('www.example.com', "data[a]=1&data[b]=five",
:content_type => 'application/x-www-form-urlencoded') # ===> Success

RestClient.post('www.example.com', '{"data":{"a":"1","b":"five"}}',
:content_type => 'application/json') # ===> Success

RestClient.post('www.example.com', '<data a="1" b="five" />',
:content_type => 'application/xml' ) # ===> Success


### Matching custom request headers ### Matching custom request headers


Expand Down Expand Up @@ -463,6 +480,7 @@ People who submitted patches and new features or suggested improvements. Many th
* Jose Angel Cortinas * Jose Angel Cortinas
* Razic * Razic
* Steve Tooke * Steve Tooke
* Nathaniel Bibler


## Background ## Background


Expand Down

0 comments on commit fb18a01

Please sign in to comment.