-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added common
RequestParams
for both Request
and `InterceptedReque…
…st`. (#384)
- Loading branch information
1 parent
8313a9c
commit 6c989a8
Showing
3 changed files
with
63 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# frozen_string_literal: true | ||
|
||
module Ferrum | ||
class Network | ||
# | ||
# Common methods used by both {Request} and {InterceptedRequest}. | ||
# | ||
module RequestParams | ||
# | ||
# The URL for the request. | ||
# | ||
# @return [String] | ||
# | ||
def url | ||
@request["url"] | ||
end | ||
|
||
# | ||
# The URL fragment for the request. | ||
# | ||
# @return [String, nil] | ||
# | ||
def url_fragment | ||
@request["urlFragment"] | ||
end | ||
|
||
# | ||
# The request method. | ||
# | ||
# @return [String] | ||
# | ||
def method | ||
@request["method"] | ||
end | ||
|
||
# | ||
# The request headers. | ||
# | ||
# @return [Hash{String => String}] | ||
# | ||
def headers | ||
@request["headers"] | ||
end | ||
|
||
# | ||
# The optional HTTP `POST` form data. | ||
# | ||
# @return [String, nil] | ||
# The HTTP `POST` form data. | ||
# | ||
def post_data | ||
@request["postData"] | ||
end | ||
alias body post_data | ||
end | ||
end | ||
end |