Documentation ¶
Index ¶
- func Bytes(val string) ([]byte, error)
- func GetRequestURL(r *http.Request) *url.URL
- func PopulateFieldFromPath(msg proto.Message, fieldPathString string, value string) error
- func URLMessageType(uri *url.URL) (protoreflect.MessageType, error)
- func WithCors(config ...CorsConfig) func(http.Handler) http.Handler
- func WithLogger() func(http.Handler) http.Handler
- func WithRedirector() func(http.Handler) http.Handler
- func WithTracer() func(http.Handler) http.Handler
- func WithTransformer() func(http.Handler) http.Handler
- type CorsConfig
- type FormDecoder
- type ResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
Bytes converts the given string representation of a byte sequence into a slice of bytes A bytes sequence is encoded in URL-safe base64 without padding
func GetRequestURL ¶
GetRequestURL returns the request URL
func PopulateFieldFromPath ¶
PopulateFieldFromPath sets a value in a nested Protobuf structure.
func URLMessageType ¶
func URLMessageType(uri *url.URL) (protoreflect.MessageType, error)
func WithCors ¶
func WithCors(config ...CorsConfig) func(http.Handler) http.Handler
WithCors creates a new Cors handler with passed options.
func WithLogger ¶
WithLogger set up the http logger.
func WithRedirector ¶
WithRedirector represents an method redirctor
func WithTracer ¶
WithTracer represents an operation telemetry
Types ¶
type CorsConfig ¶
type CorsConfig struct { // AllowedOrigins is a list of origins a cross-domain request can be executed from. // If the special "*" value is present in the list, all origins will be allowed. // An origin may contain a wildcard (*) to replace 0 or more characters // (i.e.: http://*.domain.com). Usage of wildcards implies a small performance penalty. // Only one wildcard can be used per origin. // Default value is ["*"] AllowedOrigins []string // AllowedMethods is a list of methods the client is allowed to use with cross-domain requests. Default value is simple methods (HEAD, GET and POST). AllowedMethods []string // AllowedHeaders is list of non simple headers the client is allowed to use with // cross-domain requests. // If the special "*" value is present in the list, all headers will be allowed. // Default value is [] but "Origin" is always appended to the list. AllowedHeaders []string // ExposedHeaders indicates which headers are safe to expose to the API of a CORS API specification ExposedHeaders []string }
CorsConfig represents the CORS options.
type FormDecoder ¶
type FormDecoder struct {
// contains filtered or unexported fields
}
FormDecoder decodes URL values into a proto message.
type ResponseWriter ¶
type ResponseWriter struct { ResponseWriter http.ResponseWriter ResponseBody io.ReadWriter StatusCode int32 ContentLength int64 }
ResponseWriter repersents a response writer.
func (*ResponseWriter) GetContentLength ¶
func (r *ResponseWriter) GetContentLength() int64
GetContentLength returns the ContentLength.
func (*ResponseWriter) GetStatusCode ¶
func (r *ResponseWriter) GetStatusCode() int32
GetStatusCode returns the StatusCode.
func (*ResponseWriter) Header ¶
func (r *ResponseWriter) Header() http.Header
Header implements http.ResponseWriter
func (*ResponseWriter) Write ¶
func (r *ResponseWriter) Write(data []byte) (int, error)
Write implements http.ResponseWriter
func (*ResponseWriter) WriteHeader ¶
func (r *ResponseWriter) WriteHeader(code int)
WriteHeader implements http.ResponseWriter