Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions lib/wreq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

unless defined?(Wreq)
module Wreq
# Current wreq gem version.
# @return [String]
VERSION = nil

# Send an HTTP request.
Expand All @@ -26,7 +28,7 @@ module Wreq
# @param url [String] Target URL
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param default_headers [Boolean, nil] Whether to apply default emulation headers
# @param query [Hash, nil] URL query parameters
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
Expand All @@ -47,7 +49,7 @@ module Wreq
# @param version [Wreq::Version, nil] HTTP version to use
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
# @return [Wreq::Response] HTTP response
def self.request(method, url, **options)
end
Expand All @@ -57,7 +59,7 @@ def self.request(method, url, **options)
# @param url [String] Target URL
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param default_headers [Boolean, nil] Whether to apply default emulation headers
# @param query [Hash, nil] URL query parameters
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
Expand All @@ -78,7 +80,7 @@ def self.request(method, url, **options)
# @param version [Wreq::Version, nil] HTTP version to use
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
# @return [Wreq::Response] HTTP response
def self.get(url, **options)
end
Expand All @@ -88,7 +90,7 @@ def self.get(url, **options)
# @param url [String] Target URL
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param default_headers [Boolean, nil] Whether to apply default emulation headers
# @param query [Hash, nil] URL query parameters
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
Expand All @@ -109,7 +111,7 @@ def self.get(url, **options)
# @param version [Wreq::Version, nil] HTTP version to use
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
# @return [Wreq::Response] HTTP response
def self.head(url, **options)
end
Expand All @@ -119,7 +121,7 @@ def self.head(url, **options)
# @param url [String] Target URL
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param default_headers [Boolean, nil] Whether to apply default emulation headers
# @param query [Hash, nil] URL query parameters
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
Expand All @@ -140,7 +142,7 @@ def self.head(url, **options)
# @param version [Wreq::Version, nil] HTTP version to use
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
# @return [Wreq::Response] HTTP response
def self.post(url, **options)
end
Expand All @@ -150,7 +152,7 @@ def self.post(url, **options)
# @param url [String] Target URL
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param default_headers [Boolean, nil] Whether to apply default emulation headers
# @param query [Hash, nil] URL query parameters
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
Expand All @@ -171,7 +173,7 @@ def self.post(url, **options)
# @param version [Wreq::Version, nil] HTTP version to use
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
# @return [Wreq::Response] HTTP response
def self.put(url, **options)
end
Expand All @@ -181,7 +183,7 @@ def self.put(url, **options)
# @param url [String] Target URL
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param default_headers [Boolean, nil] Whether to apply default emulation headers
# @param query [Hash, nil] URL query parameters
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
Expand All @@ -202,7 +204,7 @@ def self.put(url, **options)
# @param version [Wreq::Version, nil] HTTP version to use
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
# @return [Wreq::Response] HTTP response
def self.delete(url, **options)
end
Expand All @@ -212,7 +214,7 @@ def self.delete(url, **options)
# @param url [String] Target URL
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param default_headers [Boolean, nil] Whether to apply default emulation headers
# @param query [Hash, nil] URL query parameters
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
Expand All @@ -233,7 +235,7 @@ def self.delete(url, **options)
# @param version [Wreq::Version, nil] HTTP version to use
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
# @return [Wreq::Response] HTTP response
def self.options(url, **options)
end
Expand All @@ -243,7 +245,7 @@ def self.options(url, **options)
# @param url [String] Target URL
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param default_headers [Boolean, nil] Whether to apply default emulation headers
# @param query [Hash, nil] URL query parameters
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
Expand All @@ -264,7 +266,7 @@ def self.options(url, **options)
# @param version [Wreq::Version, nil] HTTP version to use
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
# @return [Wreq::Response] HTTP response
def self.trace(url, **options)
end
Expand All @@ -274,7 +276,7 @@ def self.trace(url, **options)
# @param url [String] Target URL
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param default_headers [Boolean, nil] Whether to apply default emulation headers
# @param query [Hash, nil] URL query parameters
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
Expand All @@ -295,7 +297,7 @@ def self.trace(url, **options)
# @param version [Wreq::Version, nil] HTTP version to use
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
# @return [Wreq::Response] HTTP response
def self.patch(url, **options)
end
Expand Down
3 changes: 3 additions & 0 deletions lib/wreq_ruby/body.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ module Wreq
# after being consumed by a request, further push or reuse is not allowed.
class BodySender
# @param capacity [Integer] channel buffer size, default 8
# @return [Wreq::BodySender] A streaming request body sender
def self.new(capacity = 8)
end

# @param data [String] binary chunk
# @return [void]
def push(data)
end

# Close the sender, signaling end of data.
# @return [void]
def close
end
end
Expand Down
Loading
Loading