cfhttp
tag/construct (https://cfdocs.org/cfhttp). The cfhttp
call will generate an HTTP/S request and parse the response into a nice CFML structure.cfhttp
calls, the default is a GET
operation.cfhttpparam
construct. This parameter can be of many different types: header, body, xml, cgi, file, url, formfield, cookie
depending on the requirements of the http endpoint.statusCode
fileContent
responseHeader
errorDetail
mimeType
text
charset
header
url
port
method
username
password
useragent
charset
resolveUrl
redirect
timeout
getAsBinary
result
multipart
cfhttpparam
construct to pass parameters to the http/s endpoint. The parameters can be of different types as we can see in the following table.header
body
value
is the body of the HTTP request.xml
text/xml
and specifies that the value
attribute contains the body of the HTTP request.cgi
header
but URL encodes the value
by default.file
url
formfield
cookie
type
name
value
file
file
type; ignored for all other types. The absolute path to the file that is sent with the request.encoded
formfield
and cgi
types; ignored for all other types. Specifies whether to URLEncode the form field or header.mimetype
file
type; invalid for all other types. Specifies the MIME media type of the file contents. The content type can include an identifier for the character encoding of the file; for example, text/html; charset=ISO-8859-1 indicates that the file is HTML text in the ISO Latin-1 character encoding.cfhttp
is very very easy to use. However, it can be cumbersome and not necessarily fluent or object oriented. For this, we have provided a module called Hyper which can help you build fluent and amazing HTTP Builders (https://forgebox.io/view/hyper)cfhttp
. Each implementation was mostly the same but slightly different. It was additionally frustrating because I really only needed to tweak a few values, usually just the Authorization
header. It would be nice to create an HTTP client pre-configured for each of these SDK's. It seemed the perfect fit for a module.HyperBuilder
. This is commonly aliased as hyper
.HyperBuilder
creates new requests. This can be done in one of two ways:new
method will create a new request with the configured defaults.HyperRequest
on the HyperBuilder
instance will create a new request and forward on the method call.HyperBuilder
lets you easily create requests with defaults while also avoiding having to deal with providers directly.HyperBuilder
is the component you will most likely inject, HyperRequest
is the component will you interact with the most. HyperRequest
provides a fluent interface to configure your HTTP call.HyperBuilder
instance. The easiest way to do this is to configure it in WireBox:init
method or by calling the appropriate HyperRequest
method on the HyperBuilder.defaults
property.