Package-Level Type Names (total 23, in which 13 are exported)
/* sort exporteds by: | */
ClientDo provides the interface for custom HTTP client implementations.
Do sends an HTTP request and returns an HTTP response.
ClientDoFuncNopClient
github.com/aws/aws-sdk-go-v2/aws.HTTPClient(interface)
*github.com/aws/aws-sdk-go-v2/aws/transport/http.BuildableClient
github.com/aws/aws-sdk-go-v2/service/s3.HTTPClient(interface)
go.pact.im/x/httpclient.Client(interface)
*net/http.Client
*net/http/httputil.ClientConn
ClientDo : github.com/aws/aws-sdk-go-v2/aws.HTTPClient
ClientDo : github.com/aws/aws-sdk-go-v2/service/s3.HTTPClient
ClientDo : go.pact.im/x/httpclient.Client
func NewClientHandler(client ClientDo) ClientHandler
ClientDoFunc provides a helper to wrap a function as an HTTP client for
round tripping requests.
Do will invoke the underlying func, returning the result.
ClientDoFunc : ClientDo
ClientDoFunc : github.com/aws/aws-sdk-go-v2/aws.HTTPClient
ClientDoFunc : github.com/aws/aws-sdk-go-v2/service/s3.HTTPClient
ClientDoFunc : go.pact.im/x/httpclient.Client
ClientHandler wraps a client that implements the HTTP Do method. Standard
implementation is http.Client.
clientClientDo
Handle implements the middleware Handler interface, that will invoke the
underlying HTTP client. Requires the input to be a Smithy *Request. Returns
a smithy *Response, or error if the request failed.
ClientHandler : github.com/aws/smithy-go/middleware.Handler
func NewClientHandler(client ClientDo) ClientHandler
ComputeContentLength provides a middleware to set the content-length
header for the length of a serialize request body.
HandleBuild adds the length of the serialized request to the HTTP header
if the length can be determined.
ID returns the identifier for the ComputeContentLength.
*ComputeContentLength : github.com/aws/smithy-go/middleware.BuildMiddleware
*ComputeContentLength : github.com/aws/smithy-go/middleware.ider
MinimumProtocolError is an error type indicating that the established connection did not meet the expected minimum
HTTP protocol version.
expectedProtoMajorintexpectedProtoMinorintprotostring
Error returns the error message.
*MinimumProtocolError : error
NopClient provides a client that ignores the request, and returns an empty
successful HTTP response value.
Do ignores the request and returns a 200 status empty response.
NopClient : ClientDo
NopClient : github.com/aws/aws-sdk-go-v2/aws.HTTPClient
NopClient : github.com/aws/aws-sdk-go-v2/service/s3.HTTPClient
NopClient : go.pact.im/x/httpclient.Client
Request provides the HTTP specific request structure for HTTP specific
middleware steps to use to serialize input, and send an operation's request.
Request*http.Request
Body is the request's body.
For client requests, a nil body means the request has no
body, such as a GET request. The HTTP Client's Transport
is responsible for calling the Close method.
For server requests, the Request Body is always non-nil
but will return EOF immediately when no body is present.
The Server will close the request body. The ServeHTTP
Handler does not need to.
Body must allow Read to be called concurrently with Close.
In particular, calling Close should unblock a Read waiting
for input.
Cancel is an optional channel whose closure indicates that the client
request should be regarded as canceled. Not all implementations of
RoundTripper may support Cancel.
For server requests, this field is not applicable.
Deprecated: Set the Request's context with NewRequestWithContext
instead. If a Request's Cancel field and context are both
set, it is undefined whether Cancel is respected.
Close indicates whether to close the connection after
replying to this request (for servers) or after sending this
request and reading its response (for clients).
For server requests, the HTTP server handles this automatically
and this field is not needed by Handlers.
For client requests, setting this field prevents re-use of
TCP connections between requests to the same hosts, as if
Transport.DisableKeepAlives were set.
ContentLength records the length of the associated content.
The value -1 indicates that the length is unknown.
Values >= 0 indicate that the given number of bytes may
be read from Body.
For client requests, a value of 0 with a non-nil Body is
also treated as unknown.
Form contains the parsed form data, including both the URL
field's query parameters and the PATCH, POST, or PUT form data.
This field is only available after ParseForm is called.
The HTTP client ignores Form and uses Body instead.
GetBody defines an optional func to return a new copy of
Body. It is used for client requests when a redirect requires
reading the body more than once. Use of GetBody still
requires setting Body.
For server requests, it is unused.
Header contains the request header fields either received
by the server or to be sent by the client.
If a server received a request with header lines,
Host: example.com
accept-encoding: gzip, deflate
Accept-Language: en-us
fOO: Bar
foo: two
then
Header = map[string][]string{
"Accept-Encoding": {"gzip, deflate"},
"Accept-Language": {"en-us"},
"Foo": {"Bar", "two"},
}
For incoming requests, the Host header is promoted to the
Request.Host field and removed from the Header map.
HTTP defines that header names are case-insensitive. The
request parser implements this by using CanonicalHeaderKey,
making the first character and any characters following a
hyphen uppercase and the rest lowercase.
For client requests, certain headers such as Content-Length
and Connection are automatically written when needed and
values in Header may be ignored. See the documentation
for the Request.Write method.
For server requests, Host specifies the host on which the
URL is sought. For HTTP/1 (per RFC 7230, section 5.4), this
is either the value of the "Host" header or the host name
given in the URL itself. For HTTP/2, it is the value of the
":authority" pseudo-header field.
It may be of the form "host:port". For international domain
names, Host may be in Punycode or Unicode form. Use
golang.org/x/net/idna to convert it to either format if
needed.
To prevent DNS rebinding attacks, server Handlers should
validate that the Host header has a value for which the
Handler considers itself authoritative. The included
ServeMux supports patterns registered to particular host
names and thus protects its registered Handlers.
For client requests, Host optionally overrides the Host
header to send. If empty, the Request.Write method uses
the value of URL.Host. Host may contain an international
domain name.
Method specifies the HTTP method (GET, POST, PUT, etc.).
For client requests, an empty string means GET.
Go's HTTP client does not support sending a request with
the CONNECT method. See the documentation on Transport for
details.
MultipartForm is the parsed multipart form, including file uploads.
This field is only available after ParseMultipartForm is called.
The HTTP client ignores MultipartForm and uses Body instead.
PostForm contains the parsed form data from PATCH, POST
or PUT body parameters.
This field is only available after ParseForm is called.
The HTTP client ignores PostForm and uses Body instead.
The protocol version for incoming server requests.
For client requests, these fields are ignored. The HTTP
client code always uses either HTTP/1.1 or HTTP/2.
See the docs on Transport for details.
// "HTTP/1.0"
// 1
// 0
RemoteAddr allows HTTP servers and other software to record
the network address that sent the request, usually for
logging. This field is not filled in by ReadRequest and
has no defined format. The HTTP server in this package
sets RemoteAddr to an "IP:port" address before invoking a
handler.
This field is ignored by the HTTP client.
RequestURI is the unmodified request-target of the
Request-Line (RFC 7230, Section 3.1.1) as sent by the client
to a server. Usually the URL field should be used instead.
It is an error to set this field in an HTTP client request.
Response is the redirect response which caused this request
to be created. This field is only populated during client
redirects.
TLS allows HTTP servers and other software to record
information about the TLS connection on which the request
was received. This field is not filled in by ReadRequest.
The HTTP server in this package sets the field for
TLS-enabled connections before invoking a handler;
otherwise it leaves the field nil.
This field is ignored by the HTTP client.
Trailer specifies additional headers that are sent after the request
body.
For server requests, the Trailer map initially contains only the
trailer keys, with nil values. (The client declares which trailers it
will later send.) While the handler is reading from Body, it must
not reference Trailer. After reading from Body returns EOF, Trailer
can be read again and will contain non-nil values, if they were sent
by the client.
For client requests, Trailer must be initialized to a map containing
the trailer keys to later send. The values may be nil or their final
values. The ContentLength must be 0 or -1, to send a chunked request.
After the HTTP request is sent the map values can be updated while
the request body is read. Once the body returns EOF, the caller must
not mutate Trailer.
Few HTTP clients, servers, or proxies support HTTP trailers.
TransferEncoding lists the transfer encodings from outermost to
innermost. An empty list denotes the "identity" encoding.
TransferEncoding can usually be ignored; chunked encoding is
automatically added and removed as necessary when sending and
receiving requests.
URL specifies either the URI being requested (for server
requests) or the URL to access (for client requests).
For server requests, the URL is parsed from the URI
supplied on the Request-Line as stored in RequestURI. For
most requests, fields other than Path and RawQuery will be
empty. (See RFC 7230, Section 5.3)
For client requests, the URL's Host specifies the server to
connect to, while the Request's Host field optionally
specifies the Host header value to send in the HTTP
request.
isStreamSeekablebool
ctx is either the client or server context. It should only
be modified via copying the whole Request using WithContext.
It is unexported to prevent people from using Context wrong
and mutating the contexts held by callers of the same request.
streamio.ReaderstreamStartPosint64
AddCookie adds a cookie to the request. Per RFC 6265 section 5.4,
AddCookie does not attach more than one Cookie header field. That
means all cookies, if any, are written into the same line,
separated by semicolon.
AddCookie only sanitizes c's name and value, and does not sanitize
a Cookie header already present in the request.
BasicAuth returns the username and password provided in the request's
Authorization header, if the request uses HTTP Basic Authentication.
See RFC 2617, Section 2.
Build returns a build standard HTTP request value from the Smithy request.
The request's stream is wrapped in a safe container that allows it to be
reused for subsequent attempts.
Clone returns a deep copy of the Request for the new context. A reference to
the Stream is copied, but the underlying stream is not copied.
Context returns the request's context. To change the context, use
WithContext.
The returned context is always non-nil; it defaults to the
background context.
For outgoing client requests, the context controls cancellation.
For incoming server requests, the context is canceled when the
client's connection closes, the request is canceled (with HTTP/2),
or when the ServeHTTP method returns.
Cookie returns the named cookie provided in the request or
ErrNoCookie if not found.
If multiple cookies match the given name, only one cookie will
be returned.
Cookies parses and returns the HTTP cookies sent with the request.
FormFile returns the first file for the provided form key.
FormFile calls ParseMultipartForm and ParseForm if necessary.
FormValue returns the first value for the named component of the query.
POST and PUT body parameters take precedence over URL query string values.
FormValue calls ParseMultipartForm and ParseForm if necessary and ignores
any errors returned by these functions.
If key is not present, FormValue returns the empty string.
To access multiple values of the same key, call ParseForm and
then inspect Request.Form directly.
GetStream returns the request stream io.Reader if a stream is set. If no
stream is present nil will be returned.
IsHTTPS returns if the request is HTTPS. Returns false if no endpoint URL is set.
IsStreamSeekable returns whether the stream is seekable.
MultipartReader returns a MIME multipart reader if this is a
multipart/form-data or a multipart/mixed POST request, else returns nil and an error.
Use this function instead of ParseMultipartForm to
process the request body as a stream.
ParseForm populates r.Form and r.PostForm.
For all requests, ParseForm parses the raw query from the URL and updates
r.Form.
For POST, PUT, and PATCH requests, it also reads the request body, parses it
as a form and puts the results into both r.PostForm and r.Form. Request body
parameters take precedence over URL query string values in r.Form.
If the request Body's size has not already been limited by MaxBytesReader,
the size is capped at 10MB.
For other HTTP methods, or when the Content-Type is not
application/x-www-form-urlencoded, the request Body is not read, and
r.PostForm is initialized to a non-nil, empty value.
ParseMultipartForm calls ParseForm automatically.
ParseForm is idempotent.
ParseMultipartForm parses a request body as multipart/form-data.
The whole request body is parsed and up to a total of maxMemory bytes of
its file parts are stored in memory, with the remainder stored on
disk in temporary files.
ParseMultipartForm calls ParseForm if necessary.
If ParseForm returns an error, ParseMultipartForm returns it but also
continues parsing the request body.
After one call to ParseMultipartForm, subsequent calls have no effect.
PostFormValue returns the first value for the named component of the POST,
PATCH, or PUT request body. URL query parameters are ignored.
PostFormValue calls ParseMultipartForm and ParseForm if necessary and ignores
any errors returned by these functions.
If key is not present, PostFormValue returns the empty string.
ProtoAtLeast reports whether the HTTP protocol used
in the request is at least major.minor.
Referer returns the referring URL, if sent in the request.
Referer is misspelled as in the request itself, a mistake from the
earliest days of HTTP. This value can also be fetched from the
Header map as Header["Referer"]; the benefit of making it available
as a method is that the compiler can diagnose programs that use the
alternate (correct English) spelling req.Referrer() but cannot
diagnose programs that use Header["Referrer"].
RewindStream will rewind the io.Reader to the relative start position if it
is an io.Seeker.
SetBasicAuth sets the request's Authorization header to use HTTP
Basic Authentication with the provided username and password.
With HTTP Basic Authentication the provided username and password
are not encrypted.
Some protocols may impose additional requirements on pre-escaping the
username and password. For instance, when used with OAuth2, both arguments
must be URL encoded first with url.QueryEscape.
SetStream returns a clone of the request with the stream set to the provided
reader. May return an error if the provided reader is seekable but returns
an error.
StreamLength returns the number of bytes of the serialized stream attached
to the request and ok set. If the length cannot be determined, an error will
be returned.
UserAgent returns the client's User-Agent, if sent in the request.
WithContext returns a shallow copy of r with its context changed
to ctx. The provided ctx must be non-nil.
For outgoing client request, the context controls the entire
lifetime of a request and its response: obtaining a connection,
sending the request, and reading the response headers and body.
To create a new request with a context, use NewRequestWithContext.
To change the context of a request, such as an incoming request you
want to modify before sending back out, use Request.Clone. Between
those two uses, it's rare to need WithContext.
Write writes an HTTP/1.1 request, which is the header and body, in wire format.
This method consults the following fields of the request:
Host
URL
Method (defaults to "GET")
Header
ContentLength
TransferEncoding
Body
If Body is present, Content-Length is <= 0 and TransferEncoding
hasn't been set to "identity", Write adds "Transfer-Encoding:
chunked" to the header. Body is closed after it is sent.
WriteProxy is like Write but writes the request in the form
expected by an HTTP proxy. In particular, WriteProxy writes the
initial Request-URI line of the request with an absolute URI, per
section 5.3 of RFC 7230, including the scheme and host.
In either case, WriteProxy also writes a Host header, using
either r.Host or r.URL.Host.
( Request) closeBody() error( Request) expectsContinue() bool
isH2Upgrade reports whether r represents the http2 "client preface"
magic string.
( Request) isReplayable() bool( Request) multipartReader(allowMixed bool) (*multipart.Reader, error)
outgoingLength reports the Content-Length of this outgoing (Client) request.
It maps 0 into -1 (unknown) when the Body is non-nil.
requiresHTTP1 reports whether this request requires being sent on
an HTTP/1 connection.
( Request) wantsClose() bool( Request) wantsHttp10KeepAlive() bool
extraHeaders may be nil
waitForContinue may be nil
always closes body
func (*Request).Clone() *Request
func (*Request).SetStream(reader io.Reader) (rc *Request, err error)
func github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/eventstreamapi.ApplyHTTPTransportFixes(r *Request) error
func github.com/aws/aws-sdk-go-v2/aws/middleware.updateHTTPHeader(request *Request, header string, value string)
func github.com/aws/aws-sdk-go-v2/service/internal/checksum.getRequestStreamLength(req *Request) (int64, error)
func github.com/aws/aws-sdk-go-v2/service/internal/checksum.setMD5Checksum(ctx context.Context, req *Request) (string, error)
func github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations.buildAccessPointHostPrefix(ctx context.Context, req *Request, tv arn.AccessPointARN) (context.Context, error)
func github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations.updateHostPrefix(req *Request, oldEndpointPrefix, newEndpointPrefix string)
func github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations.updateS3HostForS3AccessPoint(req *Request)
func github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations.updateS3HostForS3ObjectLambda(req *Request)
RequestResponseLogger is a deserialize middleware that will log the request and response HTTP messages and optionally
their respective bodies. Will not perform any logging if none of the options are set.
LogRequestboolLogRequestWithBodyboolLogResponseboolLogResponseWithBodybool
HandleDeserialize will log the request and response HTTP messages if configured accordingly.
ID is the middleware identifier.
*RequestResponseLogger : github.com/aws/smithy-go/middleware.DeserializeMiddleware
*RequestResponseLogger : github.com/aws/smithy-go/middleware.ider
RequestSendError provides a generic request transport error. This error
should wrap errors making HTTP client requests.
The ClientHandler will wrap the HTTP client's error if the client request
fails, and did not fail because of context canceled.
Errerror
ConnectionError returns that the error is related to not being able to send
the request, or receive a response from the service.
(*RequestSendError) Error() string
Unwrap returns the underlying error, if there was one.
*RequestSendError : error
RequireMinimumProtocol is a deserialization middleware that asserts that the established HTTP connection
meets the minimum major ad minor version.
ProtoMajorintProtoMinorint
HandleDeserialize asserts that the established connection is a HTTP connection with the minimum major and minor
protocol version.
ID returns the middleware identifier string.
*RequireMinimumProtocol : github.com/aws/smithy-go/middleware.DeserializeMiddleware
*RequireMinimumProtocol : github.com/aws/smithy-go/middleware.ider
ResponseError provides the HTTP centric error type wrapping the underlying
error with the HTTP response value.
ErrerrorResponse*Response(*ResponseError) Error() string
HTTPResponse returns the HTTP response received from the service.
HTTPStatusCode returns the HTTP response status code received from the service.
Unwrap returns the nested error if any, or nil.
*ResponseError : error
UserAgentBuilder is a builder for a HTTP User-Agent string.
sbstrings.Builder
AddKey adds the named component/product to the agent string
AddKeyValue adds the named key to the agent string with the given value.
Build returns the constructed User-Agent string. May be called multiple times.
(*UserAgentBuilder) appendTo(value string)
func NewUserAgentBuilder() *UserAgentBuilder
func github.com/aws/aws-sdk-go-v2/aws/middleware.addProductName(builder *UserAgentBuilder)
contentMD5Checksum provides a middleware to compute and set
content-md5 checksum for a http request
HandleBuild adds behavior to compute md5 checksum and add content-md5 header
on http request
ID returns the identifier for the checksum middleware
*contentMD5Checksum : github.com/aws/smithy-go/middleware.BuildMiddleware
*contentMD5Checksum : github.com/aws/smithy-go/middleware.ider
removeDefaultContentType provides after serialization middleware that will
remove the content-type header from an HTTP request if the header was set as
a default value by the operation serializer, and there is no request payload.
HandleSerialize implements the serialization middleware.
ID returns the middleware ID
removeDefaultContentType : github.com/aws/smithy-go/middleware.SerializeMiddleware
removeDefaultContentType : github.com/aws/smithy-go/middleware.ider
validateContentLength provides a middleware to validate the content-length
is valid (greater than zero), for the serialized request payload.
HandleBuild adds the length of the serialized request to the HTTP header
if the length can be determined.
ID returns the identifier for the ComputeContentLength.
*validateContentLength : github.com/aws/smithy-go/middleware.BuildMiddleware
*validateContentLength : github.com/aws/smithy-go/middleware.ider
Package-Level Functions (total 35, in which 28 are exported)
AddCloseResponseBodyMiddleware adds the middleware to automatically close
the response body of an operation request, after the response had been
deserialized.
AddComputeContentLengthMiddleware adds ComputeContentLength to the middleware
stack's Build step.
AddContentChecksumMiddleware adds checksum middleware to middleware's
build step.
AddErrorCloseResponseBodyMiddleware adds the middleware to automatically
close the response body of an operation request if the request response
failed.
AddHeaderValue returns a stack mutator that adds the header value pair to header.
Appends to any existing values if present.
AddNoPayloadDefaultContentTypeRemover Adds the DefaultContentTypeRemover
middleware to the stack after the operation serializer. This middleware will
remove the content-type header from the request if it was set as a default
value, and no request payload is present.
Returns error if unable to add the middleware.
AddRequireMinimumProtocol adds the RequireMinimumProtocol middleware to the stack using the provided minimum
protocol major and minor version.
DisableEndpointHostPrefix sets or modifies whether the request's endpoint host
prefixing should be disabled. If value is true, endpoint host prefixing
will be disabled.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack
values.
GetHostnameImmutable retrieves whether the endpoint hostname should be considered
immutable or not.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack
values.
GetIsContentTypeDefaultValue returns if the content-type HTTP header on the
request is a default value that was auto assigned by an operation
serializer. Allows middleware post serialization to know if the content-type
was auto set to a default value or not.
Also returns false if the Context value was never updated to include if
content-type was set to a default value.
IsEndpointHostPrefixDisabled retrieves whether the hostname prefixing is
disabled.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack
values.
JoinPath returns an absolute URL path composed of the two paths provided.
Enforces that the returned path begins with '/'. If added path is empty the
returned path suffix will match the first parameter suffix.
JoinRawQuery returns an absolute raw query expression. Any duplicate '&'
will be collapsed to single separator between values.
NewClientHandler returns an initialized middleware handler for the client.
NewStackRequest returns an initialized request ready to be populated with the
HTTP request details. Returns empty interface so the function can be used as
a parameter to the Smithy middleware Stack constructor.
NewUserAgentBuilder returns a new UserAgentBuilder.
ParseTime parses a time string like the HTTP Date header. This uses a more
relaxed rule set for date parsing compared to the standard library.
RemoveNoPayloadDefaultContentTypeRemover removes the
DefaultContentTypeRemover middleware from the stack. Returns an error if
unable to remove the middleware.
RequestCloner is a function that can take an input request type and clone the request
for use in a subsequent retry attempt.
SetHeaderValue returns a stack mutator that adds the header value pair to header.
Replaces any existing values if present.
SetHostnameImmutable sets or modifies whether the request's endpoint hostname
should be considered immutable or not.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack
values.
SetIsContentTypeDefaultValue returns a Context specifying if the request's
content-type header was set to a default value.
SplitHeaderListValues attempts to split the elements of the slice by commas,
and return a list of all values separated. Returns error if unable to
separate the values.
SplitHTTPDateTimestampHeaderListValues attempts to split the HTTP-Date
timestamp values in the slice by commas, and return a list of all values
separated. The split is aware of the HTTP-Date timestamp format, and will skip
comma within the timestamp value. Returns an error if unable to split the
timestamp values.
ValidateContentLengthHeader adds middleware that validates request content-length
is set to value greater than zero.
ValidateEndpointHost validates that the host string passed in is a valid RFC
3986 host. Returns error if the host is not valid.
ValidHostLabel returns whether the label is a valid RFC 3986 host abel.
ValidPortNumber returns whether the port is valid RFC 3986 port.
computeMD5Checksum computes base64 md5 checksum of an io.Reader's contents.
Returns the byte slice of md5 checksum and an error.