Documentation ¶
Overview ¶
Package pub is used for the publishing of requests. It contains the options to use in Connector.Publish
Index ¶
- type Option
- func AddHeader(name string, value string) Option
- func Baggage(name string, value string) Option
- func Body(body any) Option
- func ContentLength(len int) Option
- func ContentType(contentType string) Option
- func CopyHeaders(headers http.Header) Option
- func DELETE(url string) Option
- func GET(url string) Option
- func HEAD(url string) Option
- func Header(name string, value string) Option
- func Method(method string) Option
- func Multicast() Option
- func Noop() Option
- func PATCH(url string) Option
- func POST(url string) Option
- func PUT(url string) Option
- func Query(args url.Values) Option
- func QueryArg(name string, value any) Option
- func QueryString(encodedQueryArgs string) Option
- func URL(url string) Option
- func Unicast() Option
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
Option is used to construct a request in Connector.Publish.
func AddHeader ¶
AddHeader adds a value to the header of the request. It is appended to any previously added values.
func Baggage ¶
Baggage sets a baggage header of the request. It overwrites any previously set value.
func Body ¶
Body sets the body of the request. Arguments of type io.Reader, io.ReadCloser, []byte and string are serialized in binary form. url.Values is serialized as form data. All other types are serialized as JSON. The Content-Type Content-Length headers will be set to match the body if they can be determined and unless already set.
func ContentLength ¶
ContentLength sets the Content-Length header of the request.
func ContentType ¶
ContentType sets the Content-Type header.
func CopyHeaders ¶
CopyHeaders copies all non-Microbus headers from an upstream request.
func Multicast ¶
func Multicast() Option
Multicast indicates that a multiple responses are expected from this request.
func QueryArg ¶
QueryArg adds the query argument to the request. The same argument may have multiple values.
func QueryString ¶
Query adds the encoded query arguments to the request. The same argument may have multiple values.
type Request ¶
type Request struct { Method string URL string Header http.Header Body io.Reader Multicast bool // contains filtered or unexported fields }
Request is used to construct an HTTP request that can be sent over the bus. Although technically public, it is used internally and should not be constructed by microservices directly.
func NewRequest ¶
NewRequest constructs a new request from the provided options.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response is a union of an http.Response and an error. Only one or the other is valid
func NewErrorResponse ¶
NewErrorResponse creates a new response containing an error
func NewHTTPResponse ¶
NewResponse creates a new response containing an http.Response