Versions in this module Expand all Collapse all v0 v0.0.4 Jan 15, 2025 v0.0.1 Jan 15, 2025 Changes in this version + func GrpcResponseIsEmpty(grpcResponseBody []byte) bool + func WriteError(w http.ResponseWriter, errJson ErrorJson, responseHeader http.Header) + type ApiProxyMiddleware struct + EndpointCreator EndpointFactory + GatewayAddress string + Timeout time.Duration + func (m *ApiProxyMiddleware) PrepareRequestForProxying(endpoint Endpoint, req *http.Request) ErrorJson + func (m *ApiProxyMiddleware) ProxyRequest(req *http.Request) (*http.Response, ErrorJson) + func (m *ApiProxyMiddleware) Run(gatewayRouter *mux.Router) + func (m *ApiProxyMiddleware) ServeHTTP(w http.ResponseWriter, req *http.Request) + func (m *ApiProxyMiddleware) WithMiddleware(path string) http.HandlerFunc + type CustomHandler = func(m *ApiProxyMiddleware, endpoint Endpoint, w http.ResponseWriter, ...) (handled bool) + type DefaultErrorJson struct + Code int + Message string + func InternalServerError(err error) *DefaultErrorJson + func InternalServerErrorWithMessage(err error, message string) *DefaultErrorJson + func TimeoutError() *DefaultErrorJson + func (e *DefaultErrorJson) Msg() string + func (e *DefaultErrorJson) SetCode(code int) + func (e *DefaultErrorJson) SetMsg(msg string) + func (e *DefaultErrorJson) StatusCode() int + type Endpoint struct + CustomHandlers []CustomHandler + DeleteRequest interface{} + DeleteResponse interface{} + Err ErrorJson + GetResponse interface{} + Hooks HookCollection + Path string + PostRequest interface{} + PostResponse interface{} + RequestQueryParams []QueryParam + RequestURLLiterals []string + func DefaultEndpoint() Endpoint + type EndpointFactory interface + Create func(path string) (*Endpoint, error) + IsNil func() bool + Paths func() []string + type ErrorJson interface + Msg func() string + SetCode func(code int) + SetMsg func(msg string) + StatusCode func() int + func Cleanup(grpcResponseBody io.ReadCloser) ErrorJson + func DeserializeGrpcResponseBodyIntoContainer(body []byte, responseContainer interface{}) ErrorJson + func DeserializeRequestBodyIntoContainer(body io.Reader, requestContainer interface{}) ErrorJson + func HandleGrpcResponseError(errJson ErrorJson, resp *http.Response, respBody []byte, w http.ResponseWriter) (bool, ErrorJson) + func HandleQueryParameters(req *http.Request, params []QueryParam) ErrorJson + func HandleURLParameters(url string, req *http.Request, literals []string) ErrorJson + func ProcessMiddlewareResponseFields(responseContainer interface{}) ErrorJson + func ProcessRequestContainerFields(requestContainer interface{}) ErrorJson + func ReadGrpcResponseBody(r io.Reader) ([]byte, ErrorJson) + func SerializeMiddlewareResponseIntoJson(responseContainer interface{}) (jsonResponse []byte, errJson ErrorJson) + func SetRequestBodyToRequestContainer(requestContainer interface{}, req *http.Request) ErrorJson + func WriteMiddlewareResponseHeadersAndBody(grpcResp *http.Response, responseJson []byte, w http.ResponseWriter) ErrorJson + type HookCollection struct + OnPostDeserializeRequestBodyIntoContainer func(endpoint *Endpoint, w http.ResponseWriter, req *http.Request) ErrorJson + OnPreDeserializeGrpcResponseBodyIntoContainer func([]byte, interface{}) (RunDefault, ErrorJson) + OnPreDeserializeRequestBodyIntoContainer func(endpoint *Endpoint, w http.ResponseWriter, req *http.Request) (RunDefault, ErrorJson) + OnPreSerializeMiddlewareResponseIntoJson func(interface{}) (RunDefault, []byte, ErrorJson) + type QueryParam struct + Enum bool + Hex bool + Name string + type RunDefault bool