Sha256: ba29ba5d3955b81dbe027be3a8fbc388247f7e25f8c432d1b208d7036c164ba2

Contents?: true

Size: 835 Bytes

Versions: 5

Compression:

Stored size: 835 Bytes

Contents

Examples here assume that <tt>net/http</tt> has been required
(which also requires +uri+):

  require 'net/http'

Many code examples here use these example websites:

- https://jsonplaceholder.typicode.com.
- http://example.com.

Some examples also assume these variables:

  uri = URI('https://jsonplaceholder.typicode.com/')
  uri.freeze # Examples may not modify.
  hostname = uri.hostname # => "jsonplaceholder.typicode.com"
  path = uri.path         # => "/"
  port = uri.port         # => 443

So that example requests may be written as:

  Net::HTTP.get(uri)
  Net::HTTP.get(hostname, '/index.html')
  Net::HTTP.start(hostname) do |http|
    http.get('/todos/1')
    http.get('/todos/2')
  end

An example that needs a modified URI first duplicates +uri+, then modifies the duplicate:

  _uri = uri.dup
  _uri.path = '/todos/1'

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
es_cli-0.1.0 vendor/bundle/ruby/3.1.0/gems/net-http-0.6.0/doc/net-http/examples.rdoc
net-http-0.6.0 doc/net-http/examples.rdoc
net-http-0.5.0 doc/net-http/examples.rdoc
net-http-0.4.1 doc/net-http/examples.rdoc
net-http-0.4.0 doc/net-http/examples.rdoc