Comments (2)
Hiya,
Thanks for your response. I agree with you that the above test works fine. In my real-world app I am actually using rest-client (http://github.com/archiloque/rest-client) to send requests, so I can only assume that rest-client is itself changing the URI before sending it to Net::HTTP.
However, it would be quite nice if Fakeweb could recognise CGI encoding in URIs and treat in indifferently. In other words, it would be nice if the following modified test passed (which would have solved my problem):
def test_query_param_encoding
FakeWeb.register_uri(:get, "http://example.com/?date=2010-07-28T14:19:47Z", :body => "body")
response = Net::HTTP.start("example.com") { |query| query.get("/?date=2010-07-28T14%3A19%3A47Z") }
assert_equal "body", response.body
end
(And vice versa I guess, though that is less important as you are unlikely to specify a CGI encoded URL when writing your test.)
from fakeweb.
I'm having trouble reproducing this. Net::HTTP seems to send out that request as-is, with no escaping of the query string. Here's my test (which passes):
def test_query_param_encoding
FakeWeb.register_uri(:get, "http://example.com/?date=2010-07-28T14:19:47Z", :body => "body")
response = Net::HTTP.start("example.com") { |query| query.get("/?date=2010-07-28T14:19:47Z") }
assert_equal "body", response.body
end
Are you sure it's Net::HTTP that's doing the encoding?
from fakeweb.
Related Issues (20)
- 1.3.0 does not recognize registered uri for post method
- FakeWeb stops @javascript (capybara & selenium) cukes from running. HOT 22
- Assigned but unused variable - uri in lib/fake_web/utility.rb:35
- using an https url HOT 2
- FakeWeb doesn't mimic Net::HTTP's check "#read_body called twice (IOError)"
- Different Responses to the same URI based on the passed data HOT 2
- "FakeWeb.allow_net_connect = true" doesn't work with PORO/ElasticSearch
- FakeWeb doesn't match non alphabetized query strings
- consider switching to Mocha 1.0 HOT 1
- please tag a new version and release a new gem HOT 4
- Unregister single URIs
- NetConnectNotAllowedError reports the URI different than what is acually being matched. HOT 3
- FakeWeb post method and check the request.body
- Too many connections error
- Release is desperately needed HOT 19
- Make it easier to access submitted data HOT 1
- Compatibility Issue with Ruby 2.4? HOT 2
- Test failures? HOT 4
- Regexp with query params fail without trailing slash after host
- Ruby 2 stops receiving security updates at the end of March
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fakeweb.