Skip to content

Commit 53e3140

Browse files
committed
Enhanced RDoc for Net::HTTP
1 parent 4444e8c commit 53e3140

File tree

1 file changed

+17
-73
lines changed

1 file changed

+17
-73
lines changed

lib/net/http/request.rb

Lines changed: 17 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -4,79 +4,23 @@
44
# it wraps together the request path and the request headers.
55
#
66
# The class should not be used directly;
7-
# instead you should use its subclasses, which are covered in the sections below.
8-
#
9-
# == About the Examples
10-
#
11-
# Examples here assume that <tt>net/http</tt> has been required
12-
# (which also requires +uri+):
13-
#
14-
# require 'net/http'
15-
#
16-
# Many code examples here use these example websites:
17-
#
18-
# - https://jsonplaceholder.typicode.com.
19-
# - http://example.com.
20-
#
21-
# Some examples also assume these variables:
22-
#
23-
# uri = URI('https://jsonplaceholder.typicode.com')
24-
# uri.freeze # Examples may not modify.
25-
# hostname = uri.hostname # => "jsonplaceholder.typicode.com"
26-
# port = uri.port # => 443
27-
#
28-
# An example that needs a modified URI first duplicates +uri+, then modifies:
29-
#
30-
# _uri = uri.dup
31-
# _uri.path = '/todos/1'
32-
#
33-
# == Requests
34-
#
35-
# === \Net::HTTP::Get
36-
#
37-
# A GET request may be sent using request class \Net::HTTP::Get:
38-
#
39-
# req = Net::HTTP::Get.new(uri) # => #<Net::HTTP::Get GET>
40-
# Net::HTTP.start(hostname) do |http|
41-
# http.request(req)
42-
# end # => #<Net::HTTPOK 200 OK readbody=true>
43-
#
44-
# === \Net::HTTP::Head
45-
#
46-
# A HEAD request may be sent using request class \Net::HTTP::Head:
47-
#
48-
# req = Net::HTTP::Head.new(uri) # => #<Net::HTTP::Head HEAD>
49-
# Net::HTTP.start(hostname) do |http|
50-
# http.request(req)
51-
# end # => #<Net::HTTPOK 200 OK readbody=true>
52-
#
53-
# === \Net::HTTP::Post
54-
#
55-
# A POST request may be sent using request class \Net::HTTP::Post:
56-
#
57-
# json = {title: 'foo', body: 'bar', userId: 1}
58-
# # => "{\"title\":\"foo\",\"body\":\"bar\",\"userId\":1}"
59-
# _uri = uri.dup
60-
# _uri.path = '/posts'
61-
# req = Net::HTTP::Post.new(_uri) # => #<Net::HTTP::Post POST>
62-
# req.body = json
63-
# req['Content-type'] = 'application/json; charset=UTF-8'
64-
# Net::HTTP.start(hostname) do |http|
65-
# http.request(req)
66-
# end # => # => #<Net::HTTPCreated 201 Created readbody=true>
67-
#
68-
# === \Net::HTTP::Patch
69-
# === \Net::HTTP::Put
70-
# === \Net::HTTP::Proppatch
71-
# === \Net::HTTP::Lock
72-
# === \Net::HTTP::Unlock
73-
# === \Net::HTTP::Options
74-
# === \Net::HTTP::Propfind
75-
# === \Net::HTTP::Delete
76-
# === \Net::HTTP::Move
77-
# === \Net::HTTP::Copy
78-
# === \Net::HTTP::Mkcol
79-
# === \Net::HTTP::Trace
7+
# instead you should use its subclasses:
8+
#
9+
# - \Net::HTTP::Get
10+
# - \Net::HTTP::Head
11+
# - \Net::HTTP::Post
12+
# - \Net::HTTP::Delete
13+
# - \Net::HTTP::Options
14+
# - \Net::HTTP::Trace
15+
# - \Net::HTTP::Patch
16+
# - \Net::HTTP::Put
17+
# - \Net::HTTP::Copy
18+
# - \Net::HTTP::Lock
19+
# - \Net::HTTP::Mkcol
20+
# - \Net::HTTP::Move
21+
# - \Net::HTTP::Propfind
22+
# - \Net::HTTP::Proppatch
23+
# - \Net::HTTP::Unlock
8024
#
8125
class Net::HTTPRequest < Net::HTTPGenericRequest
8226
# Creates an HTTP request object for +path+.

0 commit comments

Comments
 (0)