mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Add an example about International domain names (#669)
Solution to non-ASCII character problem
This commit is contained in:
parent
9ca514d672
commit
868053fce7
3 changed files with 13 additions and 1 deletions
|
@ -48,7 +48,6 @@ puts stack_exchange.users
|
|||
```
|
||||
|
||||
See the [examples directory](http://github.com/jnunemaker/httparty/tree/master/examples) for even more goodies.
|
||||
|
||||
## Command Line Interface
|
||||
|
||||
httparty also includes the executable `httparty` which can be
|
||||
|
|
|
@ -84,3 +84,6 @@
|
|||
|
||||
* [Accessing x509 Peer Certificate](peer_cert.rb)
|
||||
* Provides access to the server's TLS certificate
|
||||
|
||||
* [Accessing IDNs](idn.rb)
|
||||
* Uses a `get` request with an International domain names, which are Urls with emojis and non-ASCII characters such as accented letters.
|
10
examples/idn.rb
Normal file
10
examples/idn.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
||||
require File.join(dir, 'httparty')
|
||||
require 'pp'
|
||||
|
||||
class Idn
|
||||
include HTTParty
|
||||
uri_adapter Addressable::URI
|
||||
end
|
||||
|
||||
pp Idn.get("https://i❤️.ws/emojidomain/💎?format=json")
|
Loading…
Reference in a new issue