Documentation
¶
Index ¶
Constants ¶
View Source
const ( // At time of writing, the version argument is required to be 1. // See https://github.com/grpc-ecosystem/grpc-gateway/blob/69669120b0e010b88291cd9d24761297c2a17582/runtime/pattern.go#L53 GrpcGatewayPatternVersion = 1 )
Variables ¶
This section is empty.
Functions ¶
func GetGlobPattern ¶
This is a function used for CORS support. It produces a Pattern object that can be attached to the grpc-gateway ServeMux object. It should match any and all URLs. The two op codes say, push the entire path to the stack 'OpPushM', and then ignore the result, 'OpNop'.
Types ¶
type ForwardResponseOptionHandler ¶
type ForwardResponseOptionHandler func(i context.Context, writer http.ResponseWriter, message proto.Message) error
This is just a type alias because the grpc-gateway library did not define one.
func GetForwardResponseOptionHandler ¶
func GetForwardResponseOptionHandler(allowedOrigins []string) ForwardResponseOptionHandler
This returns a handler to be used with the runtime.WithForwardResponseOption() function. This is middleware that will add the CORS header below to all requests. Certain requests like GET will not trigger a preflight request and instead the browser expects this header to be present in the response.
Source Files
¶
- cert_utils.go
- cors.go
Click to show internal directories.
Click to hide internal directories.