Documentation
¶
Overview ¶
Package httpegressapi implements the public API of the http.egress.core microservice, including clients and data structures.
The HTTP egress microservice relays HTTP requests to the internet.
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Do(ctx context.Context, req *http.Request) (resp *http.Response, err error)
- func (_c *Client) ForHost(host string) *Client
- func (c *Client) Get(ctx context.Context, url string) (resp *http.Response, err error)
- func (_c *Client) MakeRequest(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
- func (_c *Client) MakeRequest_Do(r *http.Request) (res *http.Response, err error)
- func (c *Client) Post(ctx context.Context, url string, contentType string, body any) (resp *http.Response, err error)
- type MulticastClient
Constants ¶
const Hostname = "http.egress.core"
Hostname is the default hostname of the microservice: http.egress.core.
Variables ¶
var (
URLOfMakeRequest = httpx.JoinHostAndPath(Hostname, `:444/make-request`)
)
Fully-qualified URLs of the microservice's endpoints.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an interface to calling the endpoints of the http.egress.core microservice. This simple version is for unicast calls.
func (*Client) MakeRequest ¶
func (_c *Client) MakeRequest(ctx context.Context, url string, contentType string, body any) (res *http.Response, err error)
MakeRequest proxies a request to a URL and returns the HTTP response, respecting the timeout set in the context. The proxied request is expected to be posted in the body of the request in binary form (RFC7231).
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
func (*Client) MakeRequest_Do ¶
MakeRequest_Do performs a customized request to the MakeRequest endpoint.
MakeRequest proxies a request to a URL and returns the HTTP response, respecting the timeout set in the context. The proxied request is expected to be posted in the body of the request in binary form (RFC7231).
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.
type MulticastClient ¶
type MulticastClient struct {
// contains filtered or unexported fields
}
MulticastClient is an interface to calling the endpoints of the http.egress.core microservice. This advanced version is for multicast calls.
func NewMulticastClient ¶
func NewMulticastClient(caller service.Publisher) *MulticastClient
NewMulticastClient creates a new multicast client to the http.egress.core microservice.
func (*MulticastClient) ForHost ¶
func (_c *MulticastClient) ForHost(host string) *MulticastClient
ForHost replaces the default hostname of this client.
func (*MulticastClient) MakeRequest ¶
func (_c *MulticastClient) MakeRequest(ctx context.Context, url string, contentType string, body any) <-chan *pub.Response
MakeRequest proxies a request to a URL and returns the HTTP response, respecting the timeout set in the context. The proxied request is expected to be posted in the body of the request in binary form (RFC7231).
If a URL is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint. If the body if of type io.Reader, []byte or string, it is serialized in binary form. If it is of type url.Values, it is serialized as form data. All other types are serialized as JSON. If a content type is not explicitly provided, an attempt will be made to derive it from the body.
func (*MulticastClient) MakeRequest_Do ¶
func (_c *MulticastClient) MakeRequest_Do(ctx context.Context, r *http.Request) <-chan *pub.Response
MakeRequest_Do performs a customized request to the MakeRequest endpoint.
MakeRequest proxies a request to a URL and returns the HTTP response, respecting the timeout set in the context. The proxied request is expected to be posted in the body of the request in binary form (RFC7231).
If a request is not provided, it defaults to the URL of the endpoint. Otherwise, it is resolved relative to the URL of the endpoint.