Skip to content

Commit 15b4b35

Browse files
authored
JSON -> Json and HTTP -> Http (#317)
1 parent 8c06e25 commit 15b4b35

32 files changed

Lines changed: 80 additions & 80 deletions

gems/smithy-client/lib/smithy-client/handler_context.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class HandlerContext
99
# @option options [Base] :client (nil)
1010
# @option options [Hash] :params ({})
1111
# @option options [Configuration] :config (nil)
12-
# @option options [HTTP::Request] :http_request (HTTP::Request.new)
13-
# @option options [HTTP::Response] :http_response (HTTP::Response.new)
12+
# @option options [Http::Request] :http_request (Http::Request.new)
13+
# @option options [Http::Response] :http_response (Http::Response.new)
1414
# @option options [Hash] :auth (nil)
1515
# @option options [Hash] :metadata ({})
1616
def initialize(options = {})
@@ -19,8 +19,8 @@ def initialize(options = {})
1919
@client = options[:client]
2020
@params = options[:params] || {}
2121
@config = options[:config]
22-
@http_request = options[:http_request] || HTTP::Request.new
23-
@http_response = options[:http_response] || HTTP::Response.new
22+
@http_request = options[:http_request] || Http::Request.new
23+
@http_response = options[:http_response] || Http::Response.new
2424
@auth = options[:auth]
2525
@retries = 0
2626
@metadata = {}
@@ -41,10 +41,10 @@ def initialize(options = {})
4141
# @return [Struct] The client configuration.
4242
attr_accessor :config
4343

44-
# @return [HTTP::Request]
44+
# @return [Http::Request]
4545
attr_accessor :http_request
4646

47-
# @return [HTTP::Response]
47+
# @return [Http::Response]
4848
attr_accessor :http_response
4949

5050
# @return [Hash]

gems/smithy-client/lib/smithy-client/http/error_inspector.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
module Smithy
66
module Client
7-
module HTTP
7+
module Http
88
# An HTTP error inspector, using hints from status code and headers.
99
class ErrorInspector
1010
def initialize(error, http_response)

gems/smithy-client/lib/smithy-client/http/headers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
module Smithy
44
module Client
5-
module HTTP
5+
module Http
66
# Provides a Hash-like interface for HTTP headers. Header names
77
# are treated indifferently as lower-cased strings. Header values
88
# are cast to strings.
99
#
10-
# headers = HTTP::Headers.new
10+
# headers = Http::Headers.new
1111
# headers['Content-Length'] = 100
1212
# headers[:Authorization] = 'Abc'
1313
#

gems/smithy-client/lib/smithy-client/http/request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
module Smithy
66
module Client
7-
module HTTP
7+
module Http
88
# Represents an HTTP request.
99
class Request
1010
# @option options [String, URI::HTTP, URI::HTTPS, nil] :endpoint (nil)

gems/smithy-client/lib/smithy-client/http/response.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
module Smithy
66
module Client
7-
module HTTP
7+
module Http
88
# Represents an HTTP Response.
99
class Response
1010
# @option options [Integer] :status_code (0)

gems/smithy-client/lib/smithy-client/net_http/handler.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def call(context)
2525
private
2626

2727
# @param [Configuration] config
28-
# @param [HTTP::Request] req
29-
# @param [HTTP::Response] resp
28+
# @param [Http::Request] req
29+
# @param [Http::Response] resp
3030
# @return [void]
3131
def transmit(config, req, resp)
3232
# Monkey patch default content-type set by Net::HTTP
@@ -85,7 +85,7 @@ def verify_bytes_received(resp, bytes_received)
8585
end
8686

8787
# @param [Configuration] config
88-
# @param [HTTP::Request] req
88+
# @param [Http::Request] req
8989
# @yieldparam [Net::HTTP] http
9090
def session(config, req, &)
9191
pool_for(config).session_for(req.endpoint, &)
@@ -106,9 +106,9 @@ def pool_options(config)
106106
end
107107
end
108108

109-
# Constructs and returns a Net::HTTP::Request object from a {HTTP::Request}.
110-
# @param [HTTP::Request] request
111-
# @return [Net::HTTP::Request]
109+
# Constructs and returns a Net::Http::Request object from a {Http::Request}.
110+
# @param [Http::Request] request
111+
# @return [Net::Http::Request]
112112
def build_net_request(request)
113113
request_class = net_http_request_class(request)
114114
req = request_class.new(request.endpoint.request_uri, net_headers_for(request))
@@ -122,9 +122,9 @@ def build_net_request(request)
122122
req
123123
end
124124

125-
# @param [HTTP::Request] request
125+
# @param [Http::Request] request
126126
# @raise [ArgumentError]
127-
# @return Returns a base `Net::HTTP::Request` class, e.g.,
127+
# @return Returns a base `Net::Http::Request` class, e.g.,
128128
# `Net::HTTP::Get`, `Net::HTTP::Post`, etc.
129129
def net_http_request_class(request)
130130
Net::HTTP.const_get(request.http_method.capitalize)
@@ -134,7 +134,7 @@ def net_http_request_class(request)
134134
end
135135

136136
# Validate that fields are not trailers and return a hash of headers.
137-
# @param [HTTP::Request] request
137+
# @param [Http::Request] request
138138
# @return [Hash<String, String>]
139139
def net_headers_for(request)
140140
# Net::HTTP adds a default header for accept-encoding (2.0.0+).
@@ -149,7 +149,7 @@ def net_headers_for(request)
149149
headers
150150
end
151151

152-
# @param [Net::HTTP::Response] response
152+
# @param [Net::Http::Response] response
153153
# @return [Hash<String, String>]
154154
def extract_headers(response)
155155
response.to_hash.transform_values(&:first)

gems/smithy-client/lib/smithy-client/plugins/retry_errors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def handle(context, retry_strategy, token)
8888
if (error = response.error)
8989
return response unless retryable?(context.http_request)
9090

91-
error_info = HTTP::ErrorInspector.new(error, context.http_response)
91+
error_info = Http::ErrorInspector.new(error, context.http_response)
9292
token = retry_strategy.refresh_retry_token(token, error_info)
9393
return response unless token
9494

gems/smithy-client/lib/smithy-client/stubbing/null_protocol.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ module Stubbing
66
# @api private
77
class NullProtocol
88
def stub_data(_config, _operation, _data)
9-
HTTP::Response.new
9+
Http::Response.new
1010
end
1111

1212
def stub_error(_config, _error_code)
13-
HTTP::Response.new
13+
Http::Response.new
1414
end
1515
end
1616
end

gems/smithy-client/lib/smithy-client/stubbing/rpc_v2_cbor.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Stubbing
66
# @api private
77
class RpcV2Cbor
88
def stub_data(config, operation, data)
9-
response = HTTP::Response.new
9+
response = Http::Response.new
1010
response.status_code = 200
1111
response.headers['Smithy-Protocol'] = 'rpc-v2-cbor'
1212
response.headers['Content-Type'] = 'application/cbor'
@@ -15,7 +15,7 @@ def stub_data(config, operation, data)
1515
end
1616

1717
def stub_error(_config, error_code)
18-
response = HTTP::Response.new
18+
response = Http::Response.new
1919
response.status_code = 400
2020
response.headers['Smithy-Protocol'] = 'rpc-v2-cbor'
2121
response.headers['Content-Type'] = 'application/cbor'

gems/smithy-client/lib/smithy-client/stubs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def http_response_stub(operation_name, data)
194194
end
195195

196196
def hash_to_http_response(data)
197-
http_response = HTTP::Response.new
197+
http_response = Http::Response.new
198198
http_response.status_code = data[:status_code]
199199
http_response.headers.update(data[:headers])
200200
http_response.body = data[:body]

0 commit comments

Comments
 (0)